I was wondering if javascript calculate (again) same expressions as it encounters them :
for example :
alert(new Date().getTime()+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1-new Date().getTime())
output : 0
it's hard to test it like it but I thought that all the +/-1
will take it some time ( a tick) so I could see a difference.
But the answer is 0.
So ,
Is it zero because its just too fast or because JS treats the first new Date() as the same as the later one ?