Tuesday, 26 January 2010

Strings in JavaScript

JavaScript has a really crappy algorithm for pushing Strings together so, where possible, you should use the inbuilt array join() method

var __string = [“string1”,“string2”,“string3”,].join();

instead of

var __string = “string1” + “string2” + “string3”

No comments:

Post a Comment