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.
|
|
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
.
|
|