+ 1
confused about timing and resolutions
I'm confused with timing and vocabulary... var a=0 //got it let b=++a /*so "a"gets increased to 1 when? before "b"is given a value? So theoretically a=1before the line of code is even read?*/ let c=a++ /*so "c" is 1 because you don't add 1to a until after the line of code is resolved? But still prior the print operation?
2 Answers
+ 2
Your conclusions are wrong while your understanding is correct.
let b= ++a;
this is a 2 step operation. first a is incremented and then b is assigned the updated value.
so a <> 1 before this line.
let c = a++;
again 2 steps. c is assigned the current value of a and then a is incremented.
0
Ok! That makes so much more sense!