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

  • Home
  • SEARCH
  • 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 7036415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:25:17+00:00 2026-05-28T01:25:17+00:00

All my constants are near the top of my javascript file like below. When

  • 0

All my constants are near the top of my javascript file like below.

When I search the core JQuery file, nothing comes up for Constant and I can’t see that they are pulling out constants? Do they not have any, do they have them spread out through the code, if so, why don’t they consolidate them?

I’m not concerned about the language construct const but the concept of pulling out your constants into one place like below.

var Constant = 
{
    VALIDATE_ON:                    1,
    JSON_ON:                        0,
    ROOT:                           '',
    PICTURES:                       '../pictures/',
    TEXT:                           '../text/',
    FAVICON:                        '../images/logo_small.ico',
    IMAGES:                         '../images/',
    GATEWAY:                        'class.ControlEntry.php',
    ENTER_KEY:                      13,
    SECOND:                         1000,
    MINUTE:                         60,
    HOUR:                           3600,
    DAY:                            43200,
    AML: 
    {
        "PASS":                     0,
        "FAIL":                     1, 
        "NOTDEFINED":               2
    }
};
  • 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-28T01:25:17+00:00Added an answer on May 28, 2026 at 1:25 am

    If you look at the jQuery source code you will also see some constants which represent for example different regular expressions at the beginning. It’s just that they are not defined in the global scope to avoid polluting it. They are defined inside the jQuery function. This way there is no risk of conflicts between different scripts that could use the same names in the global scope.

    So, of course that it is a good idea to consolidate your constants, just don’t pollute the global scope.

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

Sidebar

Related Questions

I have a Class named Constants that contains all the constant variable in my
Is there a Java package with all the annoying time constants like milliseconds/seconds/minutes in
I've noticed many (all?) PHP constants have a single-letter prefix, like E_NOTICE , T_STRING
Django tutorials everywhere use constant-set application name all around - in urls file, in
How can I get all constants of any type using reflection?
How does one go about saying goodbye to all constants, objects, and the like
All, I have a class file that is used to store all the constants
in my config.php where i have all constants i set the PATH to a
I've just read all of objective-c global constants variables Q&A but I found them
I want to define a constant that should be available in all of 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.