Integer to letter

Benchmark created on


Preparation HTML

<script>
  function getRandomInt (min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
  }
  ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
</script>

Setup

var n = getRandomInt(0, 25);

Test runner

Ready to run.

Testing in
TestOps/sec
String.fromCharCode
String.fromCharCode(65 + n);
ready
literal #charAt
"ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt[n]
ready
cached #charAt
ALPHABET.charAt[n]
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.