scrimba
Binary Search
Imperative
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

binary-search.js
run
preview
console
/* Typical comparison function */
let defaultCompare = (a, b) =>
a > b ? 1 : (a < b ? -1 : 0);

/* Version 1:
O(n)
Fixed memory
Loops
*/
let binarySearchWithLoops = (array, element, compare = defaultCompare) => {
return -1;
};

export default binarySearchWithLoops;
Console
AssertionError: Expected values to be strictly deep-equal: (/binary-search.test.js:5)
,
/index.html
-8:22