More:
function Point(x, y) {
this.{x,y};
}
function Monster(name) {
this.{
name: name,
@strength: 10,
@age: 0
};
}
// namespace exists in multiple files (possibly less relevant with modules)
namespace.{
function1() {
},
function2() {
}
}
>>> If we do classes, what .{ use-cases remain?
>>
>> The operator allows you to use object literals (including all of the
>> niceties that will be introduced in ES.next) where you previously had to do
>> multiple assignments. It’s especially nice for adding things to prototypes.
>> For example:
>>
>> function Person(name) {
>> this.name = name;
>> }
>> Person.prototype . {
>> describe() {
>> return "Person called "+this.name;
>> }
>> };
>
> That's a good point -- it preserves .constructor, unlike assigning a fresh
> object literal to Person.prototype.
>
> /be
--
Dr. Axel Rauschmayer
[email protected]
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss