Skip to content

Instantly share code, notes, and snippets.

@er2
Created July 25, 2022 17:56
Show Gist options
  • Save er2/e482b8a32378f765cf8d5d7f0533513b to your computer and use it in GitHub Desktop.
Save er2/e482b8a32378f765cf8d5d7f0533513b to your computer and use it in GitHub Desktop.
Uppercase numbers
function uppercaseNumbers(num) {
if (num === 1)
return "¹"
if (num === 2 || num === 3)
return String.fromCodePoint("²".codePointAt(0) + (num - 2))
return String.fromCodePoint("⁴".codePointAt(0) + (num - 4))
}
for (let i = 0; i < 10; i++)
console.log(i + "\t" + uppercaseNumbers(i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment