Integer to letter (v2)

Revision 2 of this 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
litera
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[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.