If you want to share logic between two JavaScript functions, you'd create a ________.

  • Closure
  • Function
  • Module
  • Prototype
To share logic between two JavaScript functions, you'd create a "Closure." A closure is a function that has access to variables from its containing (enclosing) function's scope, allowing you to encapsulate and share logic between functions without exposing it to the global scope.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *