busca bin c3 a1ria em javascript

Solutions on MaxInterview for busca bin c3 a1ria em javascript by the best coders in the world

showing results for - "busca bin c3 a1ria em javascript"
Caterina
13 Oct 2018
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