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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:00:10+00:00 2026-05-29T08:00:10+00:00

Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} Function declaration

  • 0

Possible Duplicate:
JavaScript: var functionName = function() {} vs function functionName() {}
Function declaration – Function Expression – Scope

I’ve learned about var a = 1, is defining a local variable, but talk about function, I thought It’s only available within the current scope as the var variable behave, what’s the difference between the following two code snippet?

function aPrint() {
console.log('a');
}

var a = function aPrent() {
console.log('a');

}
  • 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-29T08:00:11+00:00Added an answer on May 29, 2026 at 8:00 am

    here is a best article that may help you.

    refer http://www.dustindiaz.com/javascript-function-declaration-ambiguity/

    1. function aPrint() {}
      Declares a function (but does not execute it).
      It will usually have some code between the curly brackets.

    2. var a = aPrint()
      Declares a variable, invokes a function (aPrint) and sets the value of aPrint to the return of the function.

    3. var a= new aPrint()
      Creates a new instance of an object based on the aPrint function. So the variable is now an Object, not just a string or a number.

    Objects can contain indexed strings, numbers and even functions, and you can add more stuff to them, they’re pretty awesome. The whole concept of Object Oriented Programming (OOP) is based on this.

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

Sidebar

Related Questions

Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} What's the
Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} Suppose we
Possible Duplicate: Javascript: var functionName = function() {} vs function functionName() {} Way 1:
Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} In JavaScript,
Possible Duplicate: Javascript: var functionName = function() {} vs function functionName() {} Is there
Possible Duplicate: Javascript: var functionName = function() {} vs function functionName() {} What is
Possible Duplicate: Get property of object in JavaScript var Terminal = function() { this.walk
Possible Duplicate: Can a JavaScript function return itself? Consider the following javascript function: var
Possible Duplicate: JavaScript: Why the anonymous function wrapper? I would like to ask you
Possible Duplicate: JavaScript Function Definition in ASP User Control Hi, I have a generic

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.