Skip to content

Searching Algorithm

Arghun-dev edited this page Jul 26, 2021 · 8 revisions

Intro to Linear Search

How do we search?

Given an array, the simplest way to search for a value is to look at every element in the array and check if it's the value we want.

if our array is not sorted, in this case the best way to search is to look at every element in the array. => That is called Linear Search

JavaScript has search!

There are many different search methods arrays in JavaScript:

  1. indexOf
  2. includes
  3. find
  4. findIndex

Clone this wiki locally