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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:29:49+00:00 2026-05-23T10:29:49+00:00

Can anyone explain to me please that if using a namespace is a good

  • 0

Can anyone explain to me please that if using a namespace is a good coding practice. And why is it needed? If it was a good approach why JQuery didn’t include it by default. There is a separate plugin to allow this functionality.

I saw this post that mentions few ways to do it. Someone mentioned about memory leak in the post that is worrisome.

Lastly, what is the best way to organize JQuery libraries?

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-23T10:29:50+00:00Added an answer on May 23, 2026 at 10:29 am

    Notes:

    • Namespacing is a good practice because you have less chance of having conflicting names with other scripts. This way, only your name-space has to be unique, but multiple name-spaces can have the same functions in them.
    • jQuery DOES use namespacing, and you do not need the plug-in. The jQuery object itself is a name-space. . . Any function inside jQuery is ‘name-spaced’ in the jQuery object. This is true for any JavaScript object.

    In response to Amir’s comment:

    YUI achieves namespacing by adding a variable to the YUI object where the added variable is also an object. Their namespace function just builds it for you.

    var lib = {
        util:{},
        widget:{},
        tool:{}
    };
    
    //creates a function named reset in the lib.util namespace
    lib.util.reset = function() {};
    
    //creates a function named reset in the lib.widget namespace
    lib.widget.reset = function() {};
    

    In jQuery, you add it to the jQuery.fn (or $.fn if you use $ for jQuery() namespace.

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

Sidebar

Related Questions

the following code is a textmate javascript snippet, can anyone explain it please? cuz
Can anyone please explain to me why the following two queries yield different results?
Can anyone please explain me what is DataContractTranslstor and what's it's use?
Can anyone please explain me about carp subroutine with sample Perl code?
can anyone please explain the concept of dispatcher, is it one dispatcher per thread
Can anyone please explain to me what is the difference between IEnumerable & IEnumerator
Can anyone, please, explain to me how to transform a phrase like I want
Can anyone explain what advantages there are to using a tool like MSBuild (or
Can anyone please explain to me how to generate an image from a remote
Can anyone explain what this mod_rewrite rule is doing? I'm trying to comment 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.