const str = "Node.js";
// Convert string to byte array
const encoder = new TextEncoder();
const byteArray = encoder.encode(str);
console.log(byteArray);
const byteArray_length = byteArray.length;
for (let i = 0; i < byteArray_length; i++) {
console.log(byteArray[i]);
}
/*
run:
Uint8Array(7) [
78, 111, 100,
101, 46, 106,
115
]
78
111
100
101
46
106
115
*/