DEV Community

San
San

Posted on

How to convert character to ASCII code using JavaScript ?

let text = "HELLO WORLD";
let code = text.charCodeAt(0);
Enter fullscreen mode Exit fullscreen mode
let text = "A";
let keyCode = text.charCodeAt(0);
console.log(keyCode)
Enter fullscreen mode Exit fullscreen mode

Output

Top comments (0)