Object.keys và Object.getOwnPropertyNames
object,tipjs,function
Object.keys
và Object.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
Lấy ngày hiện tại trong javascript
Lấy ngày hiện tại trong javascript
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.
Chuyển đổi thời gian trong javascript
Sử dụng Object.entries(), Array.prototype.filter() và Array.prototype.map(). Trả về định dạng ngày, giờ, phút với một miliseconds đã cho.
Await in a for loop
How to Await in a for loop
Hàm lày ngày trong tuần javascript
Hàm lày ngày trong tuần javascript