JavaScript Short Performance Tips


Use a prototype for shared stuff. Common methods of a “class” of objects should be declared in a prototype. The reason for this is so that we don’t need to build all of these methods with every single instance of the object.

Use a document fragment to append multiple DOM elements. This is more efficient that appending elements one at a time.

Use the join() method instead of += if possible.