title: Using a constant to define a function within a function?
body: <p>Main questions:
  1. How does f refer to r and t within the formula but no declaration for them anywhere in the code. Also the references appear to be cyclical. 
  2. Why is f2 set to f(x) what does that accomplish? </p>
  
  <pre><code>let x = 3;
  let y = 7;
  const f = function(r) { 
          return function(t) { 
                return x + y + Math.abs(r) + t; 
             } 
        };
  const f2 = f(x);
  x = 2;
  alert(f2(17));
  </code></pre>
  
  <p>This code works but I do not understand what it is doing.</p>
  
  <p>Thank you for your help.</p>