magnify
magnify
Home 2013 August
category

Insert and delete items in a JavaScript array

Published on August 21, 2013 by in JavaScript

It is a common idea that arrays in Javascript are not as flexible as they figure. Javascript arrays and insertion There are dedicating functions to insert items at the beginning (unshift) or at the end (push) of a javascript array, but it seems to not be possible to insert, it only seems… Array.prototype.unshift doc Unshift

Read More…

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 
category

“For in” Trouble

Published on August 15, 2013 by in JavaScript

I saw a lot of time developers using “for in” instead of “for (i = 0; i < list.length; i++)" just because it's shorter. It's a big mistake because, when you use "for in" pattern, you have to check if the key is a own property of the object, else you're going to have big

Read More…

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments