Oct 16, 2009

efficency string operation

Because string is immutable in JavaScript, concatenation with array.join('') is much efficient. The following code use all the chinese characters. Click here to show

      var sb = [];
        sb[sb.length] = "

"; for (var i = 0x4e00; i <= 0x9fcf; i++) { sb[sb.length] = String.fromCharCode(i); } sb[sb.length] = "

"; $("#chinese").html(sb.join("")); return false;