1function linearSearch(value, list) {
2 let found = false;
3 let position = -1;
4 let index = 0;
5
6 while(!found && index < list.length) {
7 if(list[index] == value) {
8 found = true;
9 position = index;
10 } else {
11 index += 1;
12 }
13 }
14 return position;
15}
16
1Set found to false
2Set position to −1
3Set index to 0
4while found is false and index < number of elements
5 if list[index] is equal to search value
6 Set found to true
7 Set position to index
8 else Add 1 to index
9return position
10