3 ms·
Shouldn't it be this.balance ? var account = { balance: undefined, deposit: function(amount) { return balance += amount; }...
by killahpriest 14y ago
Shouldn't it be this.balance ?
var account = {
balance: undefined,
deposit: function(amount) {
return balance += amount;
}...
}
- masklinn 14y agoIn javascript yes. Munificent probably got a bit confused with java (that's what he seems to be using in the rest of the post, and from what I remember it's his historical go-to language) or with Dart (I don't know if dart mandates `this` for self-attributes)
- munificent 14y agoHa, yes, you're exactly right. I'll fix that in the post. :) Dart does indeed allow you to omit "this." which is really really nice.