Single plus operator in javascript [duplicate]

The plus converts a string to a float. The code you provided is equivalent to the following:

if ( obj.length === Number(obj.length) ) {
    // ...
}

Leave a Comment