Preview:
function firstFunction() {
  // parent function
  const x = 100; // parent variable / cant be used inside the child function

  function secondFunction() {
    const y = 60; // child variable / cannot be called in the parent function
    return y + x; // return calculation to the child function
  }

  return secondFunction(); // evoke the second function by returning it to the parent function
}

console.log(firstFunction()); // call the parent function
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter