N/APosted on - 03/09/2012
Hi everyone, please consider the following code segment and tell me what is the values z after executing the code segment
x = 800;
y = 45;
x += 60;
y %= 1.5;
z = x + y;
Find the value of a variable on Java Script code
Hi Mary ,
This is a simple code i guess , I think i can find an answer for this I guess.
1. First step is that x is initialized and now the variable x has 800 as value .
2. y is initialized and it has 45 as value.
3. x+=60 is short of x = x + 60; so x has now 800 + 60 that is 860.
4. y%=1.5 is a short code of y=y%1.5 that is 0.675
5. z= x + y so z = 650 + 0.675
So final value z is having 650.675
Hope that solves your problem .