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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:01:32+00:00 2026-06-18T12:01:32+00:00

Can anyone explain the difference in behaviour between Internet Explorer and Firefox in regards

  • 0

Can anyone explain the difference in behaviour between Internet Explorer and Firefox in regards to the below:

var myNamespace = (function () {
  var exposed = {};

  exposed.myFunction = function myFunction () {
    return "Works!";
  }

  console.log(myFunction()); 
  // IE: "Works!"
  // Firefox: ReferenceError: myFunction is not defined

  console.log(exposed.myFunction());
  // IE: "Works!"
  // FF: "Works!"

  return exposed;
})();

console.log(myNamespace.myFunction()); 
// IE: "Works!"
// FF: "Works!"

In internet explorer this method allows me to call my function from inside my namespace function by using either myFunction() or exposed.myFunction().

Outside my namepsace function I can use myNamespace.myFunction()

In Firefox, the results are the same with the exception of the bare named function call which does not work.

Should it work? If it shouldn’t, then why not?

If it should then is this a known bug?

  • 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-18T12:01:34+00:00Added an answer on June 18, 2026 at 12:01 pm

    To prevent false information:

    IE has a problem with named function expressions which is what you have. The name of the function should only be available inside the function. From the specification:

    The Identifier in a FunctionExpression can be referenced from inside the FunctionExpression‘s FunctionBody to allow the function to call itself recursively. However, unlike in a FunctionDeclaration, the Identifier in a FunctionExpression cannot be referenced from and does not affect the scope enclosing the FunctionExpression.

    where FunctionExpression is defined as:

    FunctionExpression :
         function Identifieropt ( FormalParameterListopt ) { FunctionBody }

    But in IE, instead of making the name only available inside the function, it creates two different function objects, one assigned to the variable and the other to the name you gave the function. The following will yield false in IE (and throw an error in other browsers):

    exposed.myFunction === myFunction;
    

    It’s a known bug and if you have to code for (older versions of) IE, you better avoid named function expressions.


    Related question:

    • detachEvent not working with named inline functions
    • Named Function Expressions in IE, part 2
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone explain the difference between a fork and a thread?
Can anyone explain the difference between thread communication and process communication and give few
Can anyone explain to me why there is a dramatic difference in performance between
Can anyone please explain to me what is the difference between IEnumerable & IEnumerator
Can anyone point me out or explain what is the difference between android Home
Can anyone explain the difference between the Ruby on Rails console output and the
Can anyone please explain what's the difference between the two kinds of getView() implementation?
Can anyone explain me difference in python shell between output variable through print and
Can anyone explain the difference between System.DateTime and System.DateTimeOffset in C#.NET? Which is best
Rails newbie here. Can anyone please explain the difference to me between the following

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.