0
How it will be 44 i don't understand?
var a=10; var k; k=(a++)+(a++)+(a--)+(a--); document.write(k);
4 Réponses
+ 4
a++ now a =11
+
a++ now a = 12
+
a-- now a = 11
+
a-- now a = 10
K = 11 + 12 + 11 + 10
+ 4
(11)+(12)+(11)+(10) = 44
You need to understand the concept of postfix and prefix✅
+ 1
Easy way to understand it
var a=10;
var k;
k=(a++)+(a++)+(a--)+(a--);
document.write(k);
a = 10
(a++) = same value 10
(a++)=but a = 11
(a--)= and now it will = 12
(a--)= minus one now its = 11
10+11+12+11=44
k = 44
😍