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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:05:12+00:00 2026-06-14T03:05:12+00:00

I get the following warning/hint/error when I have an object like this: ( function

  • 0

I get the following warning/hint/error when I have an object like this:

(
    function global(){...};
    function moreFunctions(){...};
)(this);

“Top-level ‘this’ expression. This inspection reports instances of Javascript ‘this’ expression occuring outside of object literals or constructor bodies. Such this expressions are legal Javascript, and reference the top-level “global” Javascript object, but are largely useless.” (by InspectionJS)

By the way, jQuery has the same with (window) instead of (this).

I don’t understand what it means. All I know is that everthing between the first ( and second ) is an object, but what’s that addition?

I’ve got into this because I’ve just discovered a JS library source and somehow when it is included in my existing scripts everything just stops working. When I deleted that (this); part it didn’t crash the page; but the library just didn’t work.

  • 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-06-14T03:05:13+00:00Added an answer on June 14, 2026 at 3:05 am

    I’m not 100% sure on the problem you’re having but let me explain what I learned from Paul Irish’s video on lessons from the JQuery source.

    (function(window, undefined) {
    })(this);
    

    This is known as a self-executing function. The function definition is put in brackets. (anything can be put in brackets in Javascript almost all the time). Then, the second () immediately calls the function.

    so it’s like doing the following

    function my_func(window, undefined){...}
    my_func(this);
    

    Now to explain the this. Usually, we wrap our entire program in such a self-executing function. The this while calling, and the window and undefined are pretty much just fixes for edge-cases when sharing the code space.
    For example, someone could put something like

    window = 0;
    //or
    undefined = 1;
    

    suddenly, these very important global variables we rely on break. using this at the top level returns the window variable to the inner function. And since we don’t pass any second variable to the function, undefined is back to its correct value.

    Hope all this helped.

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

Sidebar

Related Questions

I get the following error within Magento CE 1.6.1.0 Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot
I get the following error running a pattern matching validation: ErrorException [ Warning ]:
I get the following error when compiling my app. warning: class 'ConfigureViewController' does not
Trying to get information from an external source, I'm receiving the following error: Warning
I get the following warning in my PHP error log: PHP Warning: date(): It
I get following Error: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given
I have some calculation going on and get the following warning (i.e. not an
When using GWT I get following warning: Referencing deprecated class 'com.google.gwt.user.client.rpc.SerializableException' While it's only
Sometimes when i try to build/compile a downloaded source, i get following warning: ld:
When building gtk2hs-buildtools with ghc 7.4.2, I get the following warning: c2hs/toplevel/C2HSConfig.hs:110:1: Warning: newtype

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.