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 6150409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:36:30+00:00 2026-05-23T19:36:30+00:00

Update: Turns out that this is a duplicate of: JSLint: Using a function before

  • 0

Update: Turns out that this is a duplicate of: JSLint: Using a function before it’s defined error

We have freshly adopted jslint in our project, and as it promised – jslint starts hurting our feelings. But not only that, it makes us questioning quite a few of the rules it has. To be honest, to me it resembles ANSI C programming style somehow. Here’s one:

JS Lint: ‘someMethodFoo’ was used before it was defined.

This occurs because we use a top-down coding style: Each file first contains the most important method. The implementation of that method is broken down into “sub”-method calls to keep the code clean and well-structured. This implies that in most cases, methods are used before they are defined. In fact, I consider this a good practice, it makes the code better understandable for future readers, and thus more maintainable.

Why would JS Lint want us to turn it upside down?

We could simply turn off this option by using the –undef flag. But are there reasons against that? For example, does the order influence the performance of an interpreter? Does that matter in an age when every browser sooner or later switches from interpreters to compilers?

  • 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-23T19:36:31+00:00Added an answer on May 23, 2026 at 7:36 pm

    It’s just a convention and the code conventions page doesn’t give any explanation as to why it’s enforced that way

    All functions should be declared before they are used. Inner functions
    should follow the var statement. This helps make it clear what
    variables are included in its scope.

    We could read it as:

    All functions should be declared before they are used. This helps make
    it clear what functions are available and what functionality they provide.

    I think that it’s recommended in order to give somebody reading the code a chance to understand what a function does before using it. If you prefer a top-down approach, i think that’s totally acceptable and you should use the --undef flag to reflect your conventions. After all, the main goal of the tool is to help you 🙂

    edit: this question on SO may help clarify why it’s useful as a warning

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

Sidebar

Related Questions

Update: So, this turns out to have nothing to do with Tortoise SVN. I
Update: Turns out that this problem was because half my mongrel did not restart.
Update : this is more-or-less a dupe , and it turns out to be
Update: Check out this follow-up question: Gem Update on Windows - is it broken?
Update: Now that it's 2016 I'd use PowerShell for this unless there's a really
I have some trivial code that looks like this: SortedDictionary<String, long> d = new
UPDATE: Focus your answers on hardware solutions please. What hardware/tools/add-in are you using to
I have found this popular PHP/MySQL Script called Zip Location by SaniSoft and it
I'm trying to create a generic function that removes duplicates from an std::vector. Since
Running into a problem where on certain servers we get an error that the

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.