title: how does this function aspect work in javascript
body: <p>i am new to js but have prior understanding of c and java, i am into this course about js but i seem to be in trouble grasping the following code and how it works</p>
  <pre><code>function multiplyBy(multiplier){
       return (
        function(x){
          return x*multiplier
       } 
    );
  }
  var multiplyBy3  = multiplyBy(3);
  console.log(multiplyBy3(10))
  </code></pre>
  <p>and the out ut is 30
  my question is how does the function decides that 3 goes to multiplier and 10 goes to x, like in my experience with c and java, i have never seen anything like it, also if i define multiple functions inside multiplyby like i have in rerun space, with some input argument will 10 copy to all of em? thanks</p>