This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function where(arr, num) { | |
// Find my place in this sorted array. | |
for (var i = 0;i<arr.length;i++){ | |
if (arr[i]<num && arr[i+1]>num){ | |
var n = i+1 | |
return n | |
}else if(arr[i]==num){ | |
return i | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function where(arr, num) { | |
// Find my place in this sorted array. | |
for (var i = 0;i<arr.length;i++){ | |
if (arr[i]<num && arr[i+1]>num){ | |
var n = i+1 | |
} | |
console.log(n) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function where(arr, num) { | |
// Find my place in this sorted array. | |
for (var i = 0;i<arr.length;i++){ | |
if (arr[i]<num && arr[i+1]>num){ | |
var n = i+1 | |
} | |
return n | |
} | |
NewerOlder