One of the functions that didn’t make the cut for jPaq is String.prototype.toCharCodes().  The reason is I don’t feel that it is a function that many people are looking for.  Still, if you are looking for a good implementation for it, you can use this:

[sourcecode language=”javascript”]
String.prototype.toCharCodes = function() {
for(var arr = this.split(“”), i = this.length – 1; i >= 0; i–)
arr[i] = arr[i].charCodeAt(0);
return arr;
};
[/sourcecode]

Categories: BlogJavaScript

Leave a Reply

Your email address will not be published. Required fields are marked *