How to find index of element in array in JavaScript

Arrays
By Jad Joubran · 
Last updated Mar 29, 2018
const colors = ["red", "green", "blue"];
colors.indexOf("green");
1
Array.indexOf on MDN