Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSLint throwing error when using console.log() [duplicate]

The text editor that I am using is Brackets. I am encountering an error message when I try to use console.log in any JS file.

1 - Create/Open an JS file

2 - Type console.log('hello world');

3 - Save the file

JSLint Problem:

error message in JSLint 'console' was used before it was defined.

like image 783
mruss24 Avatar asked Dec 23 '22 23:12

mruss24


1 Answers

Use the devel option:

true if browser globals that are useful in development should be predefined, and if debugger statements and TODO comments should be allowed. It adds the same globals as this directive:

/*global
alert, confirm, console, prompt
*/

Be sure to turn this option off before going into production.

So at the top of your script add this line:

 /*jslint devel: true */
like image 136
trincot Avatar answered Jan 22 '23 02:01

trincot