js functions inside of objects
var person = {
name: "Fred",
sayName: function() {
console.log(this.name);
}
};
person.sayName();
js functions inside of objects
var person = {
name: "Fred",
sayName: function() {
console.log(this.name);
}
};
person.sayName();
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"
function inside object javascript
var obj = {
func: function(a, b) {
return a * b;
}
};
obj.func(3, 6); // 18
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