+ 3
Who will help me understand this...
var x=1,y=1; document.write(++x==2 && y++ ==1); document.write(x,y); X=2,y=2 var x=1,y=1; document.write(++x==3 && y++ ==1); document.write(x,y); X=2,y=1
4 odpowiedzi
+ 5
what could surprise you is the last document.write:
as ++x is not equals to 3, second part of condition is not executed, so y is no increased ;)
+ 5
++x means increment the value of x first and use it so in the first print statement x = 2 now so it would look like this 2==2&&
y++ means use the current value of y first and then increment so in the print statement y = 1 and once the statment has finished y increases to 2
So y and x both equal 2 after the first print method but inside the method it would look like this (2==2&&1==1);
+ 3
Hi! do you not understand the entire code or some part of it?
0
😲😲😲🙄😳