Notes on Mrs. Tini’s counter: 0xFF, 0b1010, 0o17, 2.5e3, 017 and 10n read the way code reads them, in a module and in an old script, and the way Number()…
Why it matters
Hex for colours and bytes, binary for flags, exponents for extreme numbers, _ for readability. Know every way of writing them and you can read other people’s code, and know when a leading 0 or an n changes the meaning.
The key idea
Prefixes and suffixes decide how it is read; the number stays one
Common mistakes
A number that starts with 0 (0377) is not 377 An old script reads it as octal (255), a module refuses it, and Number('0377') reads 377. Use a plain prefix, 0o377, or drop the leading zero.
1n + 1 throws a TypeError, though it looks like a plain number A BigInt and a Number cannot be mixed. Convert yourself: 1n + BigInt(1) or Number(1n) + 1.
Thinking 1_000 has another value than 1000 In code _ is only for the eye: 1_000 === 1000. But as text, Number('1_000') gives NaN.
Try it in this playground
Write 255 two ways 0xFF and 255, or 0b11111111: the same number.
Try an exponent 2.5e3 is 2500, 2.5e-3 is 0.0025: no row of zeros.
017 in a module An old script reads 15, a module refuses it, Number() reads 17.
Add an n A BigInt: another type, and a + 1 throws a TypeError.