How to convert all character of a string into ASCII code in JavaScript

1 Answer

0 votes
const s = "javascript";

for (let i = 0; i < s.length; i++) {
    let ascii =  s.charCodeAt(i);
    console.log(ascii);
}



/*
run:

106
97
118
97
115
99
114
105
112
116

*/

 



answered Sep 17, 2020 by avibootz
...