Skip to content
Advertisement

Why is this code showing $req variable undefined?

JavaScript

Advertisement

Answer

As @lagbox mention, you are in an anonymous function and it can’t reach the outer scope so to fix this problem you need to use use like this

JavaScript

for more info about anonymous function check the docs here

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