Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Recently I learned that in Javascript,

  [5 * 5] * 2 // 50
  [5 + 5] * 2 // NaN
  1 + [5 * 5] * 3 // 76
  1 + [5 * 5] - 1 // 124
Interestingly, even Typescript will not ( by default ) catch this class of bugs.


[5+5]*2 is not NaN


True, I was playing around to get examples in runJS. I think I mis pasted that one. Oh well.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: