Implement the Binary Search Algorithm - step 16

Tell us what’s happening:

trying to complete step 16 (saw post on this topic, but it did not help)

…instead of returning only pathToTarget in the if statement, add a template literal with the message Value found at index ${mid}.

Your code so far


 if (value === valueAtMiddle) {
      return pathToTarget)+ `, \\Value found at index ${mid}`;
    } else if (value > valueAtMiddle) {
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  return [[], "Value not found"];
}

TY

Lesson URL (copy - paste from your browser’s address bar)

Hi @AEA2002,

Consider returning an array with both values.

Happy coding

are you sure this is correct syntax? like that ) after pathToTarget, where is the matching (?