Posted By

Sephr on 03/12/09


Tagged

String js18 charCode


Versions (?)

string.toCharCodes & String.fromCharCodes [JS 1.8]


 / 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.

  1. String.prototype.toCharCodes = function toCharCodes()
  2. Array.prototype.map.call(this, function(str) str.charCodeAt(0));
  3. String.fromCharCodes = function fromCharCodes(charCodes)
  4. String.fromCharCode.apply(this, charCodes);

Report this snippet  

You need to login to post a comment.