I AM LISTENING TO
|

WHAT I LIKE

Danone Generation Growth by Nutricia Easy way to print or alert an object in javascript
Development     Javascript    

Scope & global variables using the window object



17. October 2014

There are many instances were you might like to define global variables, that can be used anywhere.

This does not work:

This works:

In case of the first $.geScript function(){…} the my_variable is only availble within the scope of the function. In the second the variable is assigned to the window object and can be used within.




Leave a Reply

Be the First to Comment!

Notify of
avatar