get value of an array javascript code example
Example 1: js fetch all elements of an array
let elements = ['A', 'B', 'C', 'D', 'E'];
elements.forEach(letter => console.log(letter.toLowerCase())); //a, b, c, d, e
Example 2: 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
}