JS arrays code example
Example 1: javascript pushing to an array
some_array = ["John", "Sally"];
some_array.push("Mike");
console.log(some_array);
["John", "Sally", "Mike"]
Example 2: javascript array
var colors = ["red","blue","green"];
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
Example 3: how to make an array in javascript
var names = ["Sanjith", "Pranav", "Aadya", "Saharsh"]
Example 4: javascript array
var food = ["cake", "apple", "Ice-Cream"]
var Number = [Math.floor(Math.random() * food.length)];
console.log(logammounts[woodloot])
Example 5: array ub js
var fruits = ['Apple', 'Banana'];
Example 6: js arrays
const colors = ["red", "orange", "yellow"];
colors[0];
colors.length;