So, let’s get on with it.
In a previous installment, we took a dive into the
this variable and how it behaves in different ES5 situations. In this installment, we’ll do the same but for so-called arrow functions, introduced in ES6.
So far we’ve learned what the relationship is between an object and its constructor’s
prototype and what happens when we change properties set on the
__proto__ property, which is also the constructor’s
undefined. But that’s not what happens.
Continue reading “JS prototypes and property values”
Continue reading “Designing out designers?”
this variable can be a little challenging. A wonderfully concise summary on the issue is found in chuckj’s answer to a StackOverflow question (modified here to account for differences between ECMAScript 5’s strict and non-strict modes):
this can be thought of as an additional parameter to the function that is bound at the call site. If the function is not called as a method then the global object (non-strict mode) or
undefined (strict mode) is passed as
Let’s see what this means (pun intended?) for various scenarios.
We’ve entered Phase Two of my game programming course, and to help support this phase, I’m putting together enchant.js | Fundamentals.
While currently not as interactive nor as descriptive as what I developed for Phase One, I’m hoping these incremental examples will make it easy for those new to programming to grok some fundamental techniques and concepts.
Again, feedback is appreciated.
I’m creating it as a just-in-time resource for the course. There a little bad-but-expedient practice in there, but it’s working quite well for the course so far. Each page is resource-complete in itself—meaning you can download just a single HTML document and later view it without a live Internet connection.
I would love to hear any feedback about it.
* I considered enchant.js, Phaser, and melonJS. There were pros and cons to each, but I ultimately went with enchant.js because I like it’s event-driven nature (better reflects how JS “should” work) and it has a smaller (and therefore less intimidating for beginners) API.