How does JavaScript deals with value which is unknown? : <p>I am new to JavaScript and reading a <a href="http://eloquentjavascript.net/03_functions.html" rel="nofollow noreferrer">book</a> and in recursive chapter, there is an example as follow</p>

<pre><code>function findSolution(target) {
  function find(current, history) {
    if (current == target)
      return history;
    else if (current &gt; target)
      return null;
    else
      return find(current + 5, "(" + history + " + 5)") ||
             find(current * 3, "(" + history + " * 3)");
  }
 *return find(1, "1"); // when will this run?
}

console.log(findSolution(24));
// → (((1 * 3) + 5) * 3)
</code></pre>

<p>I am unable to understand how does JavaScript will run these causes as it expects a value of <code>current</code> in all three <code>if</code> cases? But the author is just running the outside of function which takes <code>target</code> as an argument, not the <code>current</code>. Does it take value of current and history from </p>

<pre><code>return find(1,"1")
</code></pre>

<p>like in hoisting?</p>
