Last active
May 28, 2016 20:21
-
-
Save pinalbhatt/1ed36b319301aac7ecbc to your computer and use it in GitHub Desktop.
JavaScript Snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Empty an Array http://davidwalsh.name/empty-array | |
myArray = []; // bad | |
myArray.length = 0; // good! | |
//http://www.w3schools.com/js/js_performance.asp | |
//bad | |
for (i = 0; i < arr.length; i++) {} | |
//good | |
var l = arr.length; | |
for (i = 0; i < l; i++) {} | |
/* | |
Writing Fast, Memory-Efficient JavaScript | |
https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/ | |
*/ | |
/* | |
10 Javascript Performance Boosting Tips from Nicholas Zakas | |
http://jonraasch.com/blog/10-javascript-performance-boosting-tips-from-nicholas-zakas | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment