What are the downsides to doing:
var myArray = []; myArray[myArray.length] = val1; myArray[myArray.length] = val2;
instead of:
Since arrays in JavaScript do not have holes the functionality of those two methods is equal. And yes, using .push() is much cleaner (and shorter).
.push()