+ 1
How can I understand it?
Please help me to understand it. function func(x) { return(x+1)+x*3; } var y = func(2); var z = func(y); document.write(z); And=37
3 Answers
+ 3
ok first
func(2)
return(2+1)+2*3; => 3+6 => func(2)=9 => y=9
second
func(y) mean func(9)
return(9+1)+9*3; => 10+27 =>37
z = 37
hope you get it ;)
+ 2
This code performs the following operation
func(2) = (2+1)+2*3=9
func(y) = func(9)= (9+1)+9*3=37
z=func(y)=37
+ 2
thanks