Simple JS code.
Go to solution
Solved by Vinod Bahadur Thapa,
first
console.log(bar(6)) will call the function bar(6) // [6 as a parameter]
then
function bar(x) { var y = 3; return foo(x*y); // now here x=6; than foo(3*6) = foo(18) , now this will call foo() function
now
function foo(b) { var a = 5; return a*b+10 } // here b=18 so 5*18 + 10 ... and rule says * priority > plus sign so 90+10 = 100
which will return 100 and this is the final output
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now