0
I wanted to know why I should use Reflection
in Javascript instead of normal operators. I only knew it existed Reflection
today and I wanted to know why it would be more useful to use Reflection
instead of normal operators.
An example would be to use Reflect.deleteProperty(target, key)
rather than delete target[key]
supposing that target
is an object.
Define "normal operators" and could describe why you think Reflection and the so-called "normal operators" do the same thing?
– Woss
@Andersoncarloswoss An example would be
Reflection.deleteProperty(target, key)
rather thandelete target[key]
this assuming thattarget
is an object– Pedro Pinto
Complete the question with this information using the [Edit button].
– Woss
In general it shouldn’t. To use something has to have justification. Do you have? I see one, but it can be because I try to do everything with simplicity.
– Maniero
@Maniero I have no justification, I just found the
Reflection
while looking at Mozilla’s Docs so I wondered if there was any reason to use it instead of operators such asdelete
,new
,in
and among others.– Pedro Pinto