Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
154
rated 0 times [  159] [ 5]  / answers: 1 / hits: 22293  / 12 Years ago, tue, august 14, 2012, 12:00:00

Possible Duplicate:

JSLint: was used before it was defined






I run JSlint and saw errors like that:



'foo' is not defined.
var x = foo();


foo is a function defined in another JavaScript file foo.js. As I understand there is no import / require directives in JavaScript to reference the foo function defined in another source file.



How can I fix this error repoted by JSlint?


More From » jslint

 Answers
60

Use the global directive to tell JSLint about foo's assumed existence.



/*global foo */


http://www.jslint.com/help.html#global


[#83642] Monday, August 13, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nellykaliae

Total Points: 119
Total Questions: 95
Total Answers: 103

Location: Pitcairn Islands
Member since Fri, Oct 15, 2021
3 Years ago
;