/ Published in: JavaScript

*Requires JavaScript 1.6 or higher*
Syntax:
`Array string.toCharCodes()` returns an array containing every one of `string`'s character codes, in order.
`String String.fromCharCodes(charCodes)` returns a string created from every character code in the array, `charCodes`.
Syntax:
`Array string.toCharCodes()` returns an array containing every one of `string`'s character codes, in order.
`String String.fromCharCodes(charCodes)` returns a string created from every character code in the array, `charCodes`.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
String.prototype.toCharCodes = function toCharCodes() { return Array.prototype.map.call(this, function(str) { return str.charCodeAt(0) }) }; String.fromCharCodes = function fromCharCodes(charCodes) { return String.fromCharCode.apply(this, charCodes) };
Comments
