Answers for "access object of object javascript"

2

js create object with properties

function Car(make, model, year) {
  this.make = make;
  this.model = model;
  this.year = year;
}
Posted by: Guest on April-01-2020
0

access an object js

// Access an object's properties
 const person1 = {};
 person1['firstname'] = 'Mario';
 person1['lastname'] = 'Rossi';

 console.log(person1.firstname);
 // expected output: "Mario"

 const person2 = {
    firstname: 'John',
    lastname: 'Doe'
 };

  console.log(person2['lastname']);
  // expected output: "Doe"
Posted by: Guest on August-05-2021

Code answers related to "access object of object javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language