The keyCode property is a read-only property and it is used to return Unicode character code of the key that triggered the onkeypress event. It is actually a number of a character like 98 for "b" character. For converting Unicode values into characters we need fromCharCode() method. Moreover, keyCode and charCode are identical. It will only work with keypress event. Otherwise, it will return a value of 0.
Its syntax is:- event.keyCod
Its return is:- number which denotes Unicode character code