Home » Development » Scope & global variables using the window object
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.
Alexander Gräf
Portfolio
Book Me
Get in touch
Live Chat
I am a full-stack developer. My expertise include:
I love programming, design and know my way around server architecture as well. I would never feel complete, with one of these missing.
I have a broad range of interests, that’s why I constantly dive into new technologies and expand my knowledge where ever required. Technologies are evolving fast and I enjoy using the latest.
Apart from that, I am a peace loving guy who tries to have people around him that think the same. I truly believe in the principle: “If you help someone, someone will help you, when you need it."