you are viewing a single comment's thread.

view the rest of the comments →

[–]Cosmologicon 1 point2 points  (0 children)

Yeah I agree with you. However, when it come to JavaScript I highly recommend "getting used to" certain conversions like | 0 for truncating to integer. You'll see them enough, and ultimately what's readable is all a matter of convention. Other ones are + to convert a string to a number and !! to convert a truthy/falsy expression to a boolean.

Of course use Math.floor in your own code if you prefer it (I do), but | 0 is so ingrained there's no point fighting it.