Answers for "object js"

5

object inside object javascript

var obj = {
  prop1: 5,
  obj2: {
    prop1: [3, 6, 3],
    prop2: 74,
    prop3: {
      str: "Hello World"
    }
  }
};

console.log(obj.obj2.prop3.str); //output: "Hello World"
Posted by: Guest on May-20-2020
4

object object javascript

person = {
    'name':'john smith'
    'age':41
};

console.log(person);
//this will return [object Object]
//use
console.log(JSON.stringify(person));
//instead
Posted by: Guest on April-20-2020
2

objects in javascript

let car = {
  engineNumber: 1234
  brand: 'BMW',
  break: function (){}
}
Posted by: Guest on December-03-2020
0

js objects

// To make an object literal:
const dog = {
    name: "Rusty",
    breed: "unknown",
    isAlive: false,
    age: 7
}
// All keys will be turned into strings!

// To retrieve a value:
dog.age; //7
dog["age"]; //7

//updating values
dog.breed = "mutt";
dog["age"] = 8;
Posted by: Guest on January-05-2021
2

objects javascript

function Dog() {
  this.name = "Bailey"; 
  this.colour = "Golden"; 
  this.breed = "Golden Retriever";
  this.age = 8;
}
Posted by: Guest on January-05-2021
0

javascript object

[object Object]
Object { }
{ }
Posted by: Guest on May-28-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language