Ad
Code
Diff
  • function binarySearch(numbers, element) {
      let result = -1;
      for (let i = 0; i<numbers.length; i++) {
        if (numbers[i] == element) {
          result = i;
        }
      }  
      return result;
    }
    • function binarySearch(numbers, element) {
    • let result = -1;
    • for (let i = 0; i<numbers.length; i++) {
    • if (numbers[i] == element) {
    • result = i;
    • }
    • }
    • return result;
    • }