function ascii(str) {
return str
.split('')
.map(function (char) {
return char + ": " + String(char.charCodeAt(0)) + "\n";
})
.reduce(function (current, previous) {
return current + previous;
});
}
alert(ascii("Hello World!"));
No comments:
Post a Comment