Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSLint: Using a function before it's defined error

I'm using JSLint to verify most of my external Javascript files, but the largest amount of errors I'm getting is from functions being used before they're defined.

Is this really an issue I should worry about?

It seems Firefox, IE7 and Chrome don't care. Functions like the popular init() (which I use often) normally stick at the top as that makes sense to me (I like to pretend it's analogous to main()) will, according to JSLint, need to be pushed to the bottom of the file.

like image 420
Chris S Avatar asked Apr 30 '09 09:04

Chris S


1 Answers

As this is the top rated google hit and other people might not be seeing it at first in the jslint tool, there is a option called "Tolerate misordered definitions" that allows you to hide this type of error.

/*jslint latedef:false*/ 
like image 66
kontur Avatar answered Sep 26 '22 10:09

kontur