DEV Community

Cover image for Display the ASCII table in JavaScript
Adrian
Adrian

Posted on • Updated on

Display the ASCII table in JavaScript

Even in the current Unicode environment, ASCII still plays a huge role in understanding computer coding systems.

With only a few lines of JavaScript code, you can display yourself all the printable ASCII characters:

for(var code = 32; code < 127; code++)
{
    var chr = String.fromCharCode(code);

    var line = chr + "\t" + code + "\t" + code.toString(16).toUpperCase();
    console.log(line);
}

Just copy the above code in an online playground and see the result.

Note: If you are using the playground from codeguppy.com replace console.log with println

Top comments (1)

Collapse
 
gdhpress1 profile image
GDH Press

Good post