Why should I use Reflection in Javascript?

Asked

Viewed 32 times

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.

  • 1

    Define "normal operators" and could describe why you think Reflection and the so-called "normal operators" do the same thing?

  • @Andersoncarloswoss An example would be Reflection.deleteProperty(target, key) rather than delete target[key] this assuming that target is an object

  • 1

    Complete the question with this information using the [Edit button].

  • 2

    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 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 as delete, new, in and among others.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.