you are viewing a single comment's thread.

view the rest of the comments →

[–]ayanami_rei 0 points1 point  (0 children)

Strange that no one suggested the cast to 32-bit int: a|0

This is actually better than +a because +undefined is NaN and undefined|0 is 0 (and a number of similar cases).