DEV Community

Cover image for Object methods in JavaScript.!
Hodiev
Hodiev

Posted on

Object methods in JavaScript.!

Obektning statik metodlari.!

Object.assign()
Object.create()
Object.defineProperties()
Object.defineProperty()
Object.entries()
Object.freeze()
Object.fromEntries()
Object.getOwnPropertyDesciptor()
Object.getOwnPropertyDesciptors()
Object.getOwnPropertyNames()
Object.getOwnProperty.Symbols()
Object.getPrototypeOf()
Object.groupBy()
Object.hasOwn()
Object.is()
Object.isExtensible()
Object.isFrozen()
Object.isSealed()
Object.keys()
Object.preventExtensions()
Object.seal()
Object.setPrototypeOf()
Object.values()

Object.assign()


const person1={
    fName:"John",
    lName:"Smith",
    age:33,
    salary:"3000$",
};
const person2={
    fName:"Oliver",
    lName:"Leo",
    age:25,
    salary:"4000$",
    hobby:"watching movies",
};
const person3={
    fName:"Benjomin",
    lName:"Mason",
    age:36,
    salary:"5000$",
    hobbies:['travel','swim','read book']
};

let result=Object.assign(person1,person2,person3);
console.log(result);

// natija.!
/*
age:36
fName:"Benjomin"
hobbies:['travel', 'swim', 'read book']
hobby:"watching movies"
lName:"Mason"
salary:"5000$"
weight:"80kg"
*/
Enter fullscreen mode Exit fullscreen mode

Object.create()

Object.entries()

const codingLang={
    lang1:"JavaScript",
    lang2:"Java",
    lang3:"PhP",
    lang4:"Go"
};

let result=Object.entries(codingLang);
console.log(result);

// natija
['lang1', 'JavaScript']
['lang2', 'Java']
['lang3', 'PhP']
['lang4', 'Go']
Enter fullscreen mode Exit fullscreen mode

Top comments (0)