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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:44:59+00:00 2026-05-23T13:44:59+00:00

While debugging I found that this kind of functions: var f = function() {};

  • 0

While debugging I found that this kind of functions:

var f = function() {};

Appear on the stack trace of firebug or webkits dev console as anonymous, and rightfully so.

Also I’ve seen people defining these as:

var someName = function otherName(){};

Which are quite weird. Note that here you cant call otherName() from anywhere but the body of otherName itself. From everywhere else you have to use someName().

My questions are:

  • Is there any problem in naming a function different from the var where it’s stored?

  • Does var a = function a(){} makes any difference besides just showing the name in the stack trace ?

  • Any other tip/suggestion on this topic 🙂

  • 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-23T13:45:00+00:00Added an answer on May 23, 2026 at 1:45 pm

    There’s no problem with assigning a function named f to a variable named a.

    A nice reference on functions is https://developer.mozilla.org/en/JavaScript/Reference/Functions_and_function_scope. Of particular interest is the section entitled “Function constructor vs. function declaration vs. function expression” which has a detailed discussion the on distinction between the function name and the variable the function is assigned to. (You may have seen this already.)

    My guess is the reason that the debugger prints something like

    var a = function a() {}
    

    is that the function’s name appears when the function value itself is serialized. The debugger is giving you all the information it has.

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

Sidebar

Related Questions

I've found that on some occasions I can edit the source while debugging. Are
Following is the example of tabs with intent data. While debugging i found that
Several times while debugging a VB.Net program I have found that continuation lines are
I am parallelizing several separated for-loops using OpenMP. While debugging in gdb, I found
Unfortunately I've found that sometimes code I'm writing, while perfectly fine at run-time, causes
While debugging through a .NET 3.5 SP1 project which is contacting a local web
Sometimes while debugging, I need to restart a service on a remote machine. Currently,
Is there any way to find all references to an object while debugging?
I would like to see the threads currently active in my application while debugging
Is it possible to iterate collection and list only filtered object information while debugging

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.