/#!/JoePea schrieb:
A use case could be to dynamically name a class at runtime without `eval`.
`let o = { [name]() {} }` produces a named function inside of `o` (at least
in Chrome) without needing eval, and then we can extract it from the object.
If you just want to name a class, there are much easier ways to do that:
let x = class {
get name() {
return dynamicName;
}
…
};
or
class x {
…
}
Object.defineProperty(x, "name", { value: dynamicName });
Kind regards,
Bergi
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss