Why is javascript recursive function returning 'undefined' even when I am returning a value : <p>I am looking at how to implement binary search in a javascript function and found that when I return the value and save it into a variable then when I console.log this comes as undefined.</p>

<pre><code>const recursiveBinarySearch = (numbers, target) =&gt; {
    const midpoint = Math.floor(numbers.length / 2);

    if (numbers[midpoint] === target){
        //it does found the value and return
        return 'FOUND';

    } else if(numbers[midpoint] &lt; target) {
        recursiveBinarySearch(numbers.slice(midpoint+1), target);

    } else {
        recursiveBinarySearch(numbers.slice(midpoint-1), target);

    }
}
var result = recursiveBinarySearch([1, 2, 3, 4, 6, 8, 100] , 8);
console.log(result); // Here is returning undefined
</code></pre>

<p>Thanks in advance.</p>
