Tuesday 12 February 2019

Explain why '+[] == 0' output 'true' in Javascript?

Explain why +[] == 0 give output 'true' in Javascript?



Please, check example.






+[] == 0 ? alert(true) : alert(false);





And also check.
'1+[+[]]' give output '10'

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...