toNumber
ECMAScript ToNumber for a string.
Two old behaviours are kept on purpose below the ES6 language level, so scripts that relied on them keep working (upstream bug 368): a hexadecimal literal parses only its valid prefix, like parseInt does, a sign is allowed in front of one, and the binary and octal prefixes are not recognised at all.
ToNumber.