title: Calculating parameter in function call
body: <p>I understand JS lambda functions (mostly when I google JS lambda and JS =&gt;) as below:</p>
  <p><code>const var = (a,b) =&gt; { return a*b }</code>
  or
  <code>const var = (a,b) =&gt; a*b</code>
  <code> const var = () =&gt; a*b</code>
  It is easy to explain that we assign value to variable by &quot;calculating&quot; anonymous function with (a,b) parameters or none.</p>
  <p>But I was unable to google my question because it was always returning general lambda format as above. My question is how to read this code:</p>
  <pre><code>let printJobId = null;
  let contentInProgress = false; 
  async function instantPrint(content) {
      await print(
        content,
        v =&gt; (printJobId = v),
        v =&gt; {
          if (v) contentInProgress = content;
          else contentInProgress = null;
        },
        doneResult =&gt; finishPrint(doneResult.status)
      ).then(result =&gt; {
        notify(result);
      });
    }
  </code></pre>
  <ol>
  <li>What exactly line <code>v =&gt; (printJobId = v)</code> does?
  It seems for me that it assigns <strong>v</strong> value to printJobId but why the hell we are placing it inside print function call, it doesnt have return value for the <strong>v</strong> on the left side.</li>
  </ol>
  <p>By saying function call I mean functionName(param1, param2) so for me it have no sense at all.</p>
  <ol start="2">
  <li>What exactly  those lines does?</li>
  </ol>
  <pre><code>v =&gt; {
          if (v) contentInProgress = content;
          else contentInProgress = null;
        }
  </code></pre>
  <p>It's similar to the first question. No return from the curly brackets {}. So the v for me looks like it is void and only do some business logic which should not be inside function call as a one of the parameters.</p>
  <p>The line</p>
  <pre><code>doneResult =&gt; finishPrint(doneResult.status)
  </code></pre>
  <p>is easy to understand as finishPrint will return some value so we pass to the print() function, doneResult variable which will have value of the finishPrint return.</p>
  <p>I have added also svelte tag as this code might be connected with it, but I believe it is only JS question.</p>
  <p>Thank you in advance for all your time!</p>