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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:29:48+00:00 2026-06-10T18:29:48+00:00

Addition in Javascript is really amazing. In Chrome and Firefox, {} + 1 equals

  • 0

Addition in Javascript is really amazing.
In Chrome and Firefox, {} + 1 equals number 1; but in Node.js, {} + 1 equals string ‘[object Object]1’. On other hand, 1 + {} equals ‘1[object Object]’ in both browsers and Node.js.
Who can explain why {} + 1 equals 1 in the browsers?

  • 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-10T18:29:50+00:00Added an answer on June 10, 2026 at 6:29 pm

    This a bit complicated. This happens, because most JavaScript engines interpret {} as a code block, not object. Thus {}+1 is essentially the same as +1. If you do (for example)

    ({}+1})
    

    then the code inside brackets () will be interpreted as a expression, not code block. Thus {} becomes an actual object.

    Read this for more details:

    http://www.2ality.com/2012/01/object-plus-object.html

    The article also explains why it is different in Node.Js.

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

Sidebar

Related Questions

Object.create is a great addition to JavaScript, because it adheres more to the prototypical
Is addition(+) operation more complex than comparison operation (>), both in integer as well
Dummy code: public object Addition(object a, object b) { var type = a.GetType(); var
I prefer not to concatenate JavaScript files in development mode, but serve them as
I'm experiencing a very weird Javascript bug in Chrome. I've made a website for
What is a prototype for a JavaScript class? In other words, what is the
hello im new and learning javascript. I'm trying to make a program of addition
I've always considered JavaScript as a great addition (or rather, for the last couple
I am trying to do a addition sum with javascript to work out the
I am not good in javascript. But recently I was given the task of

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.