Skip to content
Advertisement

Javascript nested function not defined

Creating a nested function, and then attempting to fill in all function parameters results in an error:

JavaScript

However on the MDN documentation, a nested function such as the following works correctly:

JavaScript

Advertisement

Answer

You’re not returning your function, what you probably want to do is:

JavaScript

Or, using function expressions:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement