0

Why not just think unresolved JavaScript variable an error?

I am from Java and cannot figure out that. Is it because JavaScript have some unresolved JavaScript variable that even IDE cannot know?

enter image description here

1 Answer 1

1

Here is a scenario: webstorm cannot predict what variables will be available globally. For example check jQuery's $ sign.

A related question: Webstorm says console is an unresolved variable

Sign up to request clarification or add additional context in comments.

1 Comment

Other reasons: variable is only known in runtime, because it is a property of json received through ajax call, for example; or, property is constructed dynamically while executing the program can thus can't be resolved during static analysis. This is a consequence of JavaScript dynamic nature: as we can't tell for sure if this unresolved variable a user error that needs to be fixed, we show it as a warning rather than error

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.