What's the difference between:
pause: function () {
this.state.gamePaused = true;
},
and
function pause() {
this.state.gamePaused = true;
}
The first example is probably part of an object, which means that pause is a function of an Javascript object and the second one pause as a stand alone function.
I'd expect to see the first example in something like:
var someObject = {
pause: function () {
this.state.gamePaused = true;
},
anotherProperty : "some value"
}
And thus it is used like:
someObject.pause();
On the other hand, the second example would be used like:
pause();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With