jquery array code example
Example 1: how to take create array using jquery
var length = 5;
var array = [];
var i = 0;
for (i = 0; i != length; i++){
array.push(i)
}
console.log(array);
Example 2: foreach jquery
$( "li" ).each(function( index ) {
console.log( index + ": " + $( this ).text() );
});
Example 3: javascript array
var colors = ["red","blue","green"];
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
Example 4: jquery create array
var colors = ['red','blue','green'];
console.log(colors[1]);
Example 5: how to make an array in javascript
var names = ["Sanjith", "Pranav", "Aadya", "Saharsh"]