I have been attempting to add elements to an array by using the current length of the array as the index for the next element. Here is an example:
var arr = ["one","two","three"];
arr[this.length] = "four";
However, instead of adding "four" to the end of the array, it replaces the first element resulting in ["four", "two", "three"]
. Am I not correctly referencing the array with this
?