Questions tagged [global-object]
39 questions
24
votes
1 answer
Order between destruction of global object and atexit in C++
I wonder that can sure order between destruction of global object and atexit in C++
I have a global object and register atexit function like below:
static MyClass g_class;
void onExit()
{
// do some destruction
}
int main()
{
…

zelon
- 297
- 2
- 8
9
votes
3 answers
ReferenceError and the global object
In JavaScript in the browser window is the global object, which means every variable defined in the global scope is a child of window. So why do I get this result:
console.log(window.foo); // No error, logs "undefined".
console.log(foo); //…

gdoron
- 147,333
- 58
- 291
- 367
6
votes
2 answers
this keyword in module pattern?
I've just started working at a new company and noticed something that looks completely wrong to me in a lot of their JS. I'm a bit hesitant to bring it up without confirming this is wrong since I'm pretty junior, I'm not a JS expert and it's only my…

Michal
- 73
- 6
5
votes
2 answers
Any insights on how to make a canvas drawing not go on top on the other?
It's a preety straight up and basic question. I think that because that must be a often action there must be made function, but I can't find it? Is there one? If there isn't does anybody know how to do it?

raej99
- 85
- 5
5
votes
5 answers
Check if a global property/function has been overwritten in JavaScript
JavaScript makes it easy to overwrite properties and functions of the global object. I'd like to find a way to check if the original version of a global property has been replaced.
Consider someone putting this in their HTML: