I'm trying to find a good reason to use Reflect.construct
to achieve something noteworthy that I could not achieve before.
I'm not looking for an answer like the one here, because that example don't seem to be very useful. For example, why would I write
function greetingFactory(name) {
return Reflect.construct(Greeting, [name]);
}
when I can just write
function greetingFactory(name) {
return new Greeting(name);
}
?
Do you know any notable use cases for Reflect.construct
?
Aucun commentaire:
Enregistrer un commentaire