js find first code example
Example 1: javascript array.find
const array1 = [5, 12, 8, 130, 44];
const found = array1.find(element => element > 10);
console.log(found);
Example 2: find a single element in array of objects javascript
myArray.find(x => x.id === '45').foo;
Example 3: js get first item from array
var colors = ["red", "green", "blue"];
var red=colors.shift();
Example 4: javascript find first element of array
let array = ["a", "b", "c", "d", "e"];
let [first1] = array;
let first2 = array[0];