Find the Index of an Element
- Create array variable like this const fruits = ["apple", "banana", "orange", "grape"];
- Create another variable like this const targetFruit = "orange";
- Using this array and for loop find index position of targetFruit value.
- If targetFruit index found then break loop.
- If targetFruit index position is found then print message like console.log("Index of", targetFruit,
"is:", targetIndex);