let input = "words".split(""); let output = []; input.forEach(letter => { output.push(letter.charCodeAt(0)) }); console.log(output) //[119, 111, 114, 100, 115]