javascript manipulate number code example
Example 1: javascript letters as number
const toChars = n => `${n >= 26 ? toChars(Math.floor(n / 26) - 1) : ''}${'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[n % 26]}`;
// Examples
toChars(0); // A
toChars(1); // B
toChars(25); // Z
Example 2: trunc number javascript
Math.trunc(number);