Skip to content

Comment on The WHY of WAT - understanding why 'JavaScript is Crazy'

Comments

> It can be a prefix ‘this number is positive’ operator where it operates on a single number.

`+` in this context is the "Unary + Operator" which coerces a value to a number via the internal `toNumber` method of the operand.

It doesn't make the number positive:

    node> +-1 // -1
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.