python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
JS: If you call the function, the result is 3, but if you bind the context with f.call(f) - the result is 5
var f = function() {
this.x = 5;
(function() {
this.x = 3;
})();
console.log(this.x);
};
var obj = {
x: 4,
m: function() {
console.log(this.x);
}
};
f(); // 3
new f(); // 5
f.c...
GROL COON
Votes: 0
Answers: 1
Why the error if semicolon not available?
It is a very simple IIFE situation in JavaScript.
But the semicolon at the end of the first line will make a huge difference whether it is over there or not.
Here is the error version and no semicolon...
krave
Votes: 0
Answers: 2
Javascript Tic Tac Toe Computer Player Does Not Play Consistently
I have created a tic tac toe game using javascript, which allows the user to play against the computer. The problem I am faced with is that the computer only plays some of the time when the user plays...
Reemy876
Votes: 0
Answers: 1
Can't resolve promise returned by Immediately Invoked Async Arrow Function
I'm trying to assign a variable to an immediately invoked async function but cannot resolve the promise it returns.
const user: any = (async () => {
try {
return JSON.parse(awai...
Thomas Huber
Votes: 0
Answers: 0