This installment of Wes Bos’ Javascript30 course demonstrates several morearray methods, e.g., Array.prototype.some(), Array.prototype.every(), Array.prototype.find() & Array.prototype.findIndex() …
Array.prototype.some(); checks if at least one element of the Array meets the condition
Array.prototype.every(); checks if every element of the Array meets the condition
Array.prototype.find(); similar to .filter() but returns just one el of Array
Array.prototype.findIndex(); returns index
// e.g.:
const band = [
{ name: 'Herbie', instrument: "piano" },
{ name: 'Wayne', instrument: "tenor sax" },
{ name: 'Freddie', instrument: "trumpet" },
{ name: 'Ron', instrument: "bass" },
{ name: 'Tony', instrument: "drums" }
];
const drummer = band.find(musician => musician.instrument === "drums");
console.log(drummer); // Object { name="Tony", instrument="drums"}
const drummerIx = band.findIndex(musician => musician.instrument === "drums");
console.log(drummerIx); // 4
const instr = band.find(musician => musician.name === "Herbie");
console.log(instr); // Object { name="Herbie", instrument="piano"}
const instrIx = band.findIndex(musician => musician.name === "Wayne");
console.log(instrIx); // 1