Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1323b90 commit 315be0eCopy full SHA for 315be0e
1 file changed
Search/linearSearch.js
@@ -6,7 +6,7 @@
6
*/
7
function SearchArray (searchNum, ar) {
8
var position = Search(ar, searchNum)
9
- if (position != -1) {
+ if (position !== -1) {
10
console.log('The element was found at ' + (position + 1))
11
} else {
12
console.log('The element not found')
@@ -16,7 +16,7 @@ function SearchArray (searchNum, ar) {
16
// Search “theArray” for the specified “key” value
17
function Search (theArray, key) {
18
for (var n = 0; n < theArray.length; n++) {
19
- if (theArray[n] == key) { return n }
+ if (theArray[n] === key) { return n }
20
}
21
return -1
22
0 commit comments