String to array of charcodes
var toCodes = function(str) {
var i, carr = [];
for(i = 0; i < str.length; i++) {
carr.push(str.charCodeAt(i));
}
return carr;
};
toCodes("hahah"); // outputs [104, 97, 104, 97, 104]
toCodes("Hahah hah!"); // outputs [72, 97, 104, 97, 104, 32, 104, 97, 104, 33]