I have used Brackets as a JavaScript editor. Highlighting syntax errors was poor. I started exploring JSHint when somebody suggested that I try "Visual Studio Code" . So I downloaded VSCode and typed this into the file test.js:
var y prompt(Enter a number);
Y=10;
y=y+5
alert(x);
There is hardly any syntax checking at all. 'a number' is underlined. That's it. No indication that Y has not been defined on line 2. Or line 3 has missing semi-colon. Or that x
is undefined on line 4.
Do I need to change some VSCode settings?
Or do I need add a JSHint linter extension?
Because VSCode does not come with a linter, you need to install a package into VSCode: https://marketplace.visualstudio.com/items?itemName=dbaeumer.jshint
Also, with JavaScript, declaring a variable without var
will work, it's just not a good way to do it for various reasons. So again, this is a linting issue.
Semicolons are not mandatory, again, a linting issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.