For this Question: Given a sorted array arr[] of N integers and a number K is given. The task is to check if the element K is present in the array or not.
<b>Note:</b> Use binary search to solve the problemThe first line of input contains a number of test cases T. For each test case, the first line of input contains a number of elements in the array, and the number K is separated by space. The next line contains N elements.

<b>Constraints:</b>
1 &le; T &le; 10
1 &le; N &le; 10<sup>5</sup>
1 &le; K &le; 10<sup>9</sup>
1 &le; arr[i] &le; 10<sup>9</sup>

<b>Sum of N over all test cases doesn't exceed 10<sup>6</sup></b>If the element is present in the array print "1" else print "-1".Sample Input:
2
5 6
1 2 3 4 6
5 2
1 3 4 5 6

Sample Output:
1
-1, I have written this Solution Code: // arr is they array to search from
    // x is target
    function binSearch(arr, x) {
        // write code here
        // do not console.log
        // return the 1 or -1

        let l = 0;
        let r = arr.length - 1;
        let mid;
        while (r >= l) {
            mid = l + Math.floor((r - l) / 2);

            // If the element is present at the middle
            // itself
            if (arr[mid] == x)
                return 1;

            // If element is smaller than mid, then
            // it can only be present in left subarray
            if (arr[mid] > x)
                r = mid - 1;

            // Else the element can only be present
            // in right subarray
            else
                l = mid + 1;
        }

        // We reach here when element is not
        // present in array
        return -1;
    }, In this Programming Language: JavaScript, Now tell me if this Code is compilable or not?