What is unary + used for in Javascript?

+length is a method to convert anything to a number.

If it’s a number, the value doesn’t change, and the comparison returns true.
If it’s not a number, the assertion is false.

Leave a Comment