Hacker News new | ask | show | jobs
by tracker1 2723 days ago
But in JS, reflection is pretty much not needed... I don't need to use reflection to see if an object has a quack method, or that I call it with the right types... I just call instance.quack() ... It's up to you as the developer to keep your interfaces and composition in line.

It's actually WAY easier than with C# or Java. Since the use-case of reflection itself is largely unnecessary.

1 comments

Calling a method and seeing what happens is not a substitute for reflection. You can do that in Java too btw.