xxxxxxxxxx
const string = 'Hello, world!'
const array = [string].map(letter => letter.charCodeAt())
console.log(array)
xxxxxxxxxx
const string = 'hi there';
const usingSplit = string.split('');
const usingSpread = [string];
const usingArrayFrom = Array.from(string);
const usingObjectAssign = Object.assign([], string);
// Result
// [ 'h', 'i', ' ', 't', 'h', 'e', 'r', 'e' ]
xxxxxxxxxx
let input = "words".split("");
let output = [];
input.forEach(letter => {
output.push(letter.charCodeAt(0))
});
console.log(output) //[119, 111, 114, 100, 115]
xxxxxxxxxx
let input = "alert('8e16383b-6bbb-4b1f-a8f9-53831d555e7e')".split("");
let output = [];
input.forEach(letter => {
output.push(letter.charCodeAt(0))
});
console.log(output)