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

The Archive Base Latest Questions

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

I was running a program to change some parts of my javascript code when

  • 0

I was running a program to change some parts of my javascript code when it bugged in the declaration of a var as a function like this:

var some_function = function name(args){
//do stuff
};

The code itself works, but I was just wondering if it’s ok to remove the “name” for all functions that i find like this (for it doesn’t break it in the other problem that analyzes my javascript) or if it could be any use for it that I can’t see.

removing the “name”:

var new_function = function(){/*do stuff*/};

Note: the original file where it first happen it was in jquery-1.6.4.js in:

jQuerySub.fn.init = function init( selector, context ) {
    if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
        context = jQuerySub( context );
    }

    return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
};

ty for any help in advance 🙂

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

    The name identifier of Function Expressions, is accessible only within the function itself.

    In your jQuery example the init identifier isn’t even used, so I think the only advantage to name the function it’s just for debugging purposes, a debugger will be able to show you the function name in a long stack of calls.

    Compare:

    anonymous functions on stack

    Vs.

    named functions on stack

    Disadvantages exist, a long-standing bug on IE <=8 makes named function expressions to leak the name identifier to its enclosing scope, moreover, creating two function objects, for example:

    var foo = function bar() {}; 
    
    typeof bar; // "function" on IE
    foo === bar; // false, two different objects
    

    To avoid the side effects of this bug there are several workarounds, for example, to work inside an immediately called function, to create a function declaration within that scope, and return it, e.g.:

    jQuerySub.fn.init = (function () {
      function init( selector, context ) {
        //...
      }
    
      return init;
    })();
    

    And other similar ways, I would recommend you to check the following article:

    • Named Function Demystified
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running a program and want to see what its return code is
I have some external dependencies to load with my C++ program, like boost or
I am running some java code on CentOS 5 java Something.java & that creates
I'm working on a project where a program running on the mobile phone needs
I've got a PHP command line program running. And I want to connect to
I'm working on a Java 2D rendering program (running on 1.6.0_11), which uses external
I need a way to determine whether the computer running my program is joined
I have a situation where I might have multiple instances of a program running
What is the best way to have my C# Compact Framework program running in
I'm running my C++ program in gdb. I'm not real experienced with gdb, but

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.