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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:53:49+00:00 2026-06-16T07:53:49+00:00

Ok am just going through basics of JavaScript and I was learning objects where

  • 0

Ok am just going through basics of JavaScript and I was learning objects where I came across this example…

JavaScript

var person = {
   firstname : "Smith",
   lastname  : "Bach"
};

And what we write in PHP is

$person = array(
    "firstname"=>"Smith", 
    "lastname"=>"Bach"
);

So is this the same thing or am making a mistake in understanding the concept?

  • 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-16T07:53:50+00:00Added an answer on June 16, 2026 at 7:53 am

    No, objects are more than that.

    Object is indeed a map/dictionary, but additionally every object inherits some of the properties (key-value pairs) from another object. That other object is called prototype.

    For example:

    var o = {
        x: 1
    };
    
    console.log(o.x === undefined);           // false, obviously
    console.log(o.toString === undefined);    // false, inherited from prototype
    

    Most commonly a prototype is set by creating an object with a constructor function:

    var d = new Date();
    console.log(d.hasOwnProperty('getYear'));     // false, it's inherited
    

    EDIT:

    Here’s how the prototype works using constructor functions (it’s one of the ways to do OOP in JS):

    // constructor function
    // starts with capital letter, should be called with new
    var Person = function (name, age) {
        // set properties of an instance
        this.name = name;
        this.age = age;
    };
    
    // functions to be inherited are in the prototype
    Person.prototype.sayHello = function () {
        return this.name + ' is ' + this.age + ' old';
    };
    
    // new:
    // - creates the object
    // - sets up inheritance from prototype
    // - sets the object as the context of the constructor function call (this)
    var p = new Person('Jason', 27);
    
    console.log(p.sayHello());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just learning the Opa language and going through their Manual. In the third
I am going through several example code banks and tutorials and just completely stumbling,
I’m just really learning Java, going through tutorials in book Java how to Program
Just going through the sample Scala code on Scala website, but encountered an annoying
I was just going through the iterative version of fibonacci series algorithm. I found
I was just going through glibc manual for description about posix_memalign function when I
I was just going through all the Mathematical stuff which is used in programming.
I know there isn't enough validation in here just going through some testing. $result
I am going through the various Google AppEngine tutorials sometimes, and I just noticed
I am going through the Tapestry beginner tutorial at: http://tapestry.apache.org/tapestry-tutorial.html I just downloaded the

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.