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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:52:34+00:00 2026-06-09T10:52:34+00:00

Possible Duplicate: What is the difference between object keys with quotes and without quotes?

  • 0

Possible Duplicate:
What is the difference between object keys with quotes and without quotes?

I mostly know JavaScript from using it, but there’s something I don’t understand yet.

What’s the difference between these two object literals:

var obj1 = {
   myProp: '123'
};

var obj2 = {
   'myProp': '123'
};

Are they just ‘synonyms’, or is there a subtle difference?

Thanks!

  • 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-09T10:52:36+00:00Added an answer on June 9, 2026 at 10:52 am

    In the object initializer syntax, keys can be numeric literals, identifiers, or strings.

    var obj1 = {
        1e9: "123" //valid because it's a numeric literal
    }
    
    var obj2 = {
        $_ASd: "123" //Valid because it's a valid identifier I.E. you could make a variable called $_Asd
    }
    
    var obj3 = {
        $ hello world: "123" //invalid because it's not an identifier, I.E. you could not make a variable called $ hello world
    }
    
    var obj4 = {
        '$ hello world': "123" //valid because it's a valid string
    }
    

    After that the key is turned into a string regardless of what it was in the syntax, so in the case of 1e9 the key will be a string "1000000000".

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

Sidebar

Related Questions

Possible Duplicate: What is the difference between object keys with quotes and without quotes?
Possible Duplicate: What is difference between instantiating an object using new vs. without This
Possible Duplicate: Difference between “var” and “object” in C# I would like to know
Possible Duplicate: Difference between using var and not using var in JavaScript For the
Possible Duplicate: c#: difference between “System.Object” and “object” Hello, In C# there are Object
Possible Duplicate: String vs string in C# I know there is no difference between
Possible Duplicate: What's the difference between IEquatable and just overriding Object.Equals() ? I know
Possible Duplicate: difference between string object and string literal Let's say I have two
Possible Duplicate: new MyObject(); vs new MyObject; What is the difference between new Object
Possible Duplicate: Ruby: difference between || and ‘or’ Using Ruby || and or are

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.