indexOf vs. find for Arrays
Both indexOf() and find() are used for finding a pattern within an array. How are they different? indexOf requires the exact string to search within array. const nums = [1, 3, 5, 7, 9]; console.log(nums.indexOf(3)); // 1 indexOf behaves very much like its string counterpart which helps to search a substring within a string. You cannot do anything more complicated than that. You can provide super powers to your ’locating an element’ quest using find and findIndex. ...