How to convert keycode to character using javascript [duplicate]

Solution 1:

String.fromCharCode() is what you want:

The fromCharCode() method converts Unicode values to characters.

Syntax

String.fromCharCode(n1, n2, ..., nX)

Solution 2:

As seen here:

String.fromCharCode((96 <= key && key <= 105) ? key-48 : key)