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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:15:42+00:00 2026-05-31T00:15:42+00:00

I have noticed jQuery and related keynote plugins like jQuery.UI pass undefined as a

  • 0

I have noticed jQuery and related keynote plugins like jQuery.UI pass undefined as a parameter into anonymous functions used in their module definitions, like so:

(function($, undefined) { ... })(jQuery);

Alternatively, I have noticed other plugins recommended by jQuery and/or others do NOT pass undefined in as a parameter.

This is probably a silly question, but…

Shouldn’t it always be available anyway? Why pass it in? Is there some sort of other purpose or trick going on here?

  • 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-31T00:15:43+00:00Added an answer on May 31, 2026 at 12:15 am

    There are two reasons for that:

    1) If undefined is a variable in the function scope rather than a global object property, minifiers can reduce it to a single letter thus achieving a better compression rate.

    2) Before ES5*, undefined was a property of the global object without write-protection. So it could be overwritten, resulting in strange and unexpected behavior. You could do something like this:

    var test = 123;
    undefined = 123;
    if (test === undefined){
       // this will actually be true, since undefined now equals 123
    }
    

    By having an function argument undefined (the name actually does not matter) which you don’t pass a parameter to, you could make sure you have a variable which really is undefined so you can test “undefinedness” against this variable.

    Btw. the safest method to test for undefined is: typeof ( var ) === 'undefined'

    (*) With EcmaScript 5, the global properties undefined, NaN and Infinity became readonly. So with its general adoption in all modern browsers – of course with the exception of IE 9 – overwriting those values was not possible anymore.

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

Sidebar

Related Questions

I have noticed jQuery (or is it Firefox) will turn some of my <span
I have noticed that sometimes people have to use multiple versions of jQuery in
I have noticed that some apps like Safari and Mail show a loading indicator
I have noticed some unexpected behaviour when using the jQuery .ready() function, whereby afterwards
I have noticed some weird behaviour in Chrome 15 and Safari regarding jquery hover
I have a web app. that uses AJAX (via jQuery). I noticed that some
Over at my site, I have noticed that while the scrollTo() method in jQuery
Have you noticed that by using jquery's slideDown(), even on elements with dynamic content,
I have noticed while monitoring/attempting to answer common jQuery questions, that there are certain
I've just stared using JQuery and SoundManger2, and I have noticed that SoundManager has

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.