What are the downsides to doing:
var myArray = []; myArray[myArray.length] = val1; myArray[myArray.length] = val2;
instead of:
var myArray = []; myArray.push(val1); myArray.push(val2);
I’m sure the push method is much more “acceptable”, but are there any differences in functionality?
Advertisement
Answer
push is way faster, almost 300% faster.