js object functions code example
Example 1: javascript check object methods
Object.getOwnPropertyNames()
Example 2: object object javascript
person = {
'name':'john smith'
'age':41
};
console.log(person);
console.log(JSON.stringify(person));
Example 3: object methods in javascript
const testScore = {
damon: 89,
shawn: 91,
keenan: 80,
kim: 89,
};
Object.keys(testScore);
Object.values(testScore);
Object.entries(testScore);
for (let person in testScore) {...}
for(let score of Object.values(testScore)){
console.log(score)
}
Example 4: adding function to objects js
var myObj = {
myFunc: function(param){
}
}