Skip to content
Advertisement

Using return value inside another function

I have these two functions:

JavaScript

and

JavaScript

When I run my script, it says that user_channel_number is not defined globally. How can I use user_channel_number inside the delete_events function?

Advertisement

Answer

Functions can not share their local variables. You can return the value from the first and pass it to the second:

JavaScript

Or save value on the object:

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