it shows error when i run it like this.
but if i first use document.write(x=4,++x); //45
and then write again document.write(x=4 + ++x )
it surprisingly runs and shows me output //4510
can anyone tell me why
it shows error when i run it like this.
but if i first use document.write(x=4,++x); //45
and then write again document.write(x=4 + ++x )
it surprisingly runs and shows me output //4510
can anyone tell me why
After the first write, x
is 5 and 45
is written, then you do x=4 + ++x
which evaluates to x=4 + 6
which is 10
, so it writes 10, leaving you with 4510.