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"
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"
javascript object
var person = {
first_name : "Marty",
last_name : "Mcfly",
born : 1968,
died : 1933,
lovers: ["Jennifer Parker","Baines McFly"]
};
js object
let car = {
name: "BMW",
colour: "black",
year: "2020",
owner: {
names = ["Andy" , "Steve" , "Tony" ]
}
};
objects in javascript
let object = {
'key1': 'value1',
'key2': 'value2',
'keyn': 'valuen',
};
console.log(object);
javascript objects
let computer = {
CPU: "Intel i9",
motherboard: "MSI MPG Z490",
graphicsCard: "NVIDIA 3090",
powerSupply: "Redragon RGPS GC-PS003",
getSpecs: function() {
return "My computer is equipped with a(n) " + this.CPU + ", a(n) " + this.motherboard + " motherboard, a(n) " + this.graphicsCard + " GPU and a(n) " + this.powerSupply + " power supply.";
}
};
console.log(computer.getSpecs());
// OUTPUT: My computer is equipped with a(n) Intel i9, a(n) MSI MPG Z490 motherboard, a(n) NVIDIA 3090 GPU and a(n) Redragon RGPS GC-PS003 power supply.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us