JS: Difference Between Reflect.Set vs Property Assignment Syntax
Reflect.set(obj, key, val)
is similar to the operator form
obj[key] = val
The difference are:
Reflect.set
is a function. The function form is useful in functional programing or generating code at run time.Reflect.set
also return true/false depends on success. The assignment form has no proper way to know if the operation is succesful.Reflect.set
provides a this Binding for Getter Setter Properties.