JavaScript 📜
October 20
JavaScript Object Iterations
Umumiy metodlar:
// Copies properties from a source object to a target object
Object.assign(target, source)
// Create Target Object
const person1 = {
firstName: "John",
lastName: "Doe",
age: 50,
eyeColor: "blue"
};
// Create Source Object
const person2 = {firstName: "Anne",lastName: "Smith"};
JavaScript Object.groupBy()
The Object.groupBy() metodi obyekt elementlarini callback funksiyadan qaytgan string qiymatlarga ko'ra guruhlaydi
Property Management Methods
// Create an Object:
const person = {
firstName: "John",
lastName : "Doe",
language : "EN"
};
// Add a Property
Object.defineProperty(person, "year", {value:"2008"});
2. Object.getOwnPropertyNames()
const person = {
firstName: "John",
lastName : "Doe",
language : "EN"
};