Object.keys và Object.getOwnPropertyNames

object,tipjs,function

Object.keysObject.getOwnPropertyNames

Person = function(name){
    this.name = name || ''
}
Person.prototype.sayHello = function(){
    console.log('hello')
}
p = new Person('yangyang')
p.age = 18
Object.defineProperties(p, {
    age:{
        enumerable:false
    }
})
console.log(Object.keys(p)) // ["name"]
console.log(Object.getOwnPropertyNames(p))  // ["name", "age"]

Có thể bạn đã miss một số snippets code

Extend Object javascript

Extend Object javascript

Lấy ngày hiện tại trong javascript

Lấy ngày hiện tại trong javascript

closure javascript

closure javascript

Using promises to catch errors

Rest Operator for Objects

Now we can use rest on the properties of an Object. It allows us to explicitly extract certain named variables, and assign any uncalled variables into a catchall Object.