Accessing variables created inside a function after the function has executed

Question:

I’m using a function which creates some variables I’d like to use after the function has processed.
I’ve tried accessing them directly but I can’t. How would I go about doing this?

Answer:

Variables inside functions don’t survive after the function has been run. If you want to access them after the function has processed, prefix them with a scope modifier.

Type this in your console for more information:

Source:

Accessing variables created inside a function after the function has executed by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply