Tuesday, 5 October 2021

Javascript +variable

 https://stackoverflow.com/questions/6682997/what-is-the-purpose-of-a-plus-symbol-before-a-variable


    if (+d) {}

The + operator returns the numeric representation of the object. So in your particular case, it would appear to be predicating the if on whether or not d is a non-zero number.

No comments:

Post a Comment