Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript stack reverse

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;

});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #stack #reverse
ADD COMMENT
Topic
Name
7+4 =