get array value in javascript code example
Example 1: javascript array
var colors = ["red","blue","green"];
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
Example 2: how to get array values in javascript
var valueAtIndex1 = myValues[1];
Example 3: how to make a array in javascript
let exampleArray = ["Example", "Lorem Ispum Dolor", "I think you've got it"]
exampleArray[1]
exampleArray[0]
console.log(exampleArray[0, 1, 2]
Example 4: javascript get array value
var array = []
array[0] = "hi"
array[1] = "dude"
var done = false
while (done == false){
var valueToFind = "hi";
var rounds = array.length;
if (rounds < 0){
return false
}
if (array[rounds] == valueToFind){
done = true
return rounds
}
rounds = rounds - 1
}