how do i add each of the contents of array_A, into the last empty position of array_B. So basically, i'm trying to fill the array from the top of the stack, down, using the contents of another array...if that makes sense.
function PopulateArrayDown() {
//Declare an empty array and its size
var myArray = [];
myArray.length = 10;
//Get last index
var lastElement =myArray.length;
//Create array of data
var Data = [1, 2, 3, 4, 5];
//For each value in data, add it to last position in myArray
$.each(Data, function (lastElement, value) {
myArray.push(lastElement, value);
lastElement -1;
});
So after this i hoped to see at [10] : 1, at [9] : 2, at [8] : 3 ect.. Fail! lastElement seemed to get reset to 0 as soon as the code got into the .each()