functionbinarySearch(arr, target) {arr.sort((a, b) => a - b); // sorted Time complexity of insertion sort => nlet s =-1;let e =arr.length;while (s +1< e) {constm= s +Math.floor((e - s) /2);if (arr[m] >= target) { e = m; } else { s = m } }if (arr[e] !== target) return-1;return e;}// Do not edit the line below.exports.binarySearch = binarySearch;