Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6799225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:49:24+00:00 2026-05-26T18:49:24+00:00

JSHint is telling me that my methods are not recognized if they are not

  • 0

JSHint is telling me that my methods are not recognized if they are not defined before they are used.

I can try to re-arrange all my methods in order but I’m hoping there is a way to aboid the warnings by “forward declaring” the methods.

I’m not too sure what the correct name is but I want the interpreter to know that these functions exist further on down in the code.

Full report here – http://www.jshint.com/reports/67008

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:49:25+00:00Added an answer on May 26, 2026 at 6:49 pm

    I want the interpreter to know that these functions exist further on down in the code.

    The interpreter does know that these functions exist further down in the code. The code should run with no problems. It is only jshint that doesn’t like it.

    There is nothing wrong with declaring your functions in the order that you find useful and meaningful, for example it is normal (and helpful) to declare related functions near each other. Personally, I find it helpful to declare page initialisation type functions at the top of my script, even though they will inevitably call other functions that are declared later.

    If you introduced some kind of “pre-declaration” to your code I would think that’d make your code harder to read and maintain, because obviously then you’ve got to match up the pre-declarations with the real declarations even though they will be spaced far apart in the code. When you come back the next week and change your functions you have to remember to update both parts of the code. Which means you’re more likely to introduce inconsistencies and bugs.

    So, given that the point of jshint is to make your code more reliable, surely you don’t want to add some artificial construct just to pass jshint even though that would make the code less reliable in the long run?

    The only restructuring you should consider to avoid that warning is re-ordering the functions, but in my opinion you’re better off ignoring the warning in this case. (Is there an option to turn the warning off?)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why does jshint warn that gConfiguration is not defined? I have it defined before
I have a lengthy JavaScript file that passes JSLint except for used before it
I would like to run JSHint on all my Javascript source files but several
Can someone explain the reason/importance of why javascriptlint (not jslint) gives the warning inc_dec_within_stmt
When I am loading my page I include a javascript library that is used
I want to automatically run JSHINT on all my javascript files as part of
I'm not a fan of ASI. But given that this is perfectly legit JavaScript,
I appreciate jslint telling me about my bad programming practices. How can I get
According to JSHint, a Javascript programmer should not add a space after the first
I'm using the node-jshint command line to lint all of my JS files. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.