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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:26:12+00:00 2026-06-12T17:26:12+00:00

Let’s consider this code: (function(){ var a = {id: 1, name: mike, lastname: ross};

  • 0

Let’s consider this code:

(function(){
    var a = {"id": "1", "name": "mike", "lastname": "ross"};
    var b = JSON.parse('{"id": "1", "name": "mike", "lastname": "ross"}');
    var c = Object.create({"id": "1", "name": "mike", "lastname": "ross"});

    document.write(typeof(a) + "</br>");
    document.write(typeof(b) + "</br>");
    document.write(typeof(c) + "</br>");
})();​

Questions

  1. Which are the differences between the three assignments?
  2. Do the objects a, b and c exactly overlap?
  3. If yes, why? If no, why?

Please add references to your answers.

Demo.

  • 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-12T17:26:13+00:00Added an answer on June 12, 2026 at 5:26 pm

    a and b are effectively identical (they have the same properties, with the same values, in the same places). c is completely different. You can see a clear difference if you log the objects to the console instead of printing limited info to the page:

    enter image description here

    c is the one on the right. It’s created an object with no own properties. The properties you specified are actually on the prototype of c. The reason for this is that the first argument to Object.create is the prototype of the object to be created.

    Note that you could use Object.create to get the same effect – just pass Object.prototype as the first argument:

    var d = Object.create(Object.prototype, { 
        "id": { "value": 1 }, //values are 'property descriptors'
        "name": { "value": "mike" }
        //etc...
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a string like this: var str = /abcd/efgh/ijkl/xxx-1/xxx-2; How do
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Let's say I have the following object: var VariableName = { firstProperty: 1, secondProperty:
Let's say I have this code: <p dataname=description> Hello this is a description. <a
Let's say I have such MYSQL table for logins: id---name---location---login_date ---------------------------------- 1----mike----usa-----21.08.2012 2----tony----uk------22.08.2012 3----tony----uk------23.08.2012
Let's say that I have a SQLite database that I create in a separate
Let's say I have a sortable list like this: $(.song-list).sortable({ handle : '.pos_handle', axis
Let say I want to create an iOS app that download music files from
Let's say I have the following data frame: > myvec name order_no 1 Amy
Let's say I have this element for displaying the website logo: <div id="web-title"> <a

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.