[Project_owners] Re: Converting Strings to Char Arrays in Javascript

Neil neil at parkwaycc.co.uk
Mon Aug 1 11:57:14 EDT 2005


WC Leung wrote:

>Is there any method faster than the following stupid way? Since I'm placing the code on my extension, using XPCOM is okay.
>
>var count = s.length;
>for (var i = 0; i<count; i++) a[i] = s.charCodeAt(i);
>  
>
a = s.split("").map(function(ch){return(ch.charCodeAt(0));});

Note that map has only recently become available.


More information about the Project_owners mailing list