Return to Snippet

Revision: 12409
at March 29, 2009 17:20 by Sephr


Updated Code
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);

Revision: 12408
at March 12, 2009 19:58 by Sephr


Initial Code
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);

Initial URL

                                

Initial Description
*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`.

Initial Title
string.toCharCodes & String.fromCharCodes [JS 1.8]

Initial Tags

                                

Initial Language
JavaScript