why does IDEA have autocomplete for methods outside an object

For example if I wrote in JavaScript:

console.

after the "." a list populates of valid and invalid methods that I can use on console. For example console.writeln() is one of the autocompletions. Is there any way to have methods that only apply to the object to avoid confusion?

0
2 comments

In general, in JavaScript it's not possible to determine with 100% reliability that a method does not apply to an object, because any third-party library can add methods to any prototype. We consider it more useful to show some invalid methods, rather than to not show some valid ones.

0

This is true. I forgot about the prototypical nature. Thank you!

0

Please sign in to leave a comment.