/ Published in: JavaScript
*Requires JavaScript 1.8 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() Array.prototype.map.call(this, function(str) str.charCodeAt(0)); String.fromCharCodes = function fromCharCodes(charCodes) String.fromCharCode.apply(this, charCodes);