Hola:
Puedes usar el atributo length de los strings y hacer un bucle...
var str="Hello world!";
for (i = 0, total = str.length; i < total; i ++)
document.write("The Unicode for the " + i + "'st character is: " + str.charCodeAt(i) + "<br />");
Saludos