10 lines
251 B
JavaScript
10 lines
251 B
JavaScript
|
function contains(arr, element) {
|
||
|
for (var i = 0; i < arr.length; i++) {
|
||
|
if (arr[i] === element) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
arr = [2, 5, 9, 6];
|
||
|
console.log(contains(arr, 5));
|