+ 1
why ? 58
What is the output of this code? function zz(x,z,a,b) { x = [9, 64, 20]; z = 50; a = x[0] + 1; b = x[2] - 2 ; return z - a + b; } document.write(zz()); answer 58
2 Answers
+ 3
z = 50
a = x[0] + 1 = 9 + 1 = 10
b = x[2] - 2 = 20 - 2 = 18
answer = z - a + b = 50 - 10 + 18 = 58
+ 1
z is equal to 50
a is equal to x[0]+1. x[0] is 9, so a = 10
b is equal to x[2]-2. x[2] is 20, so b=18.
z-a+b is equivalent to 50-10+18, which equals 58.
Therefore, function zz() returns 58.



