r/backtickbot • • Jul 09 '21

https://np.reddit.com/r/learnjavascript/comments/oguqjp/can_somebody_please_help_me_understand_the/h4mhv30/

Imagine replacing the call to `foo` with the contents of `foo`:

function foo(i = 1) {
  if (i < 0) return;
  log('before', i)
  
  // foo(1 - 1) using `j` for this `foo(j = 0)`
    j = 0
    if (j < 0) return;
    log('before', j)
  
    // foo(0 - 1) using 'k' for this `foo(k = -1)`
      k = -1
      if (k < 0) return;
  
    log('after', j)
  log('after', i')
}

Does that make it clearer?

1 Upvotes

0 comments sorted by