lundi 19 juin 2017

JavaScript: Difference between Reflect.get() and obj['foo']

Can't understand why I should use Reflect.get(obj, 'foo') instead of obj['foo'], or why the first one is useful as we can do the same thing using the good and old object bracket notation. Can someone please elaborate?

var obj = {foo: 'bar'};
obj['foo'];
Reflect.get(obj, 'foo');





Aucun commentaire:

Enregistrer un commentaire