Write a function that takes a sorted array of numbers and a target number. The function must return the index of the target number in the array if the array contains that number. Otherwise return -1.
Input 1:
const numbers = [ 4, 8, 9, 12, 18 ];
const target = 9;
searchTarget(numbers, target);
Output 1:
2
Input 2:
const numbers = [ 4, 8, 9, 12, 18 ];
const target = 5;
searchTarget(numbers, target);
Output 2:
-1