JavaScript Obyektlari.!
Obyektlar judaham ko'p qiymatlarni o'z ichiga olishi mumkin bo'lgan container ,o'zgaruvchi hisoblanadi.!
Obyektlarni obyekt litiralidan foydalanib va obyekt konstruktoridan foydalanib e'lon qilinadi.!
Obyektlarni litiralusulda xosil qilish qulay va foydalanishga tavsiya etiladi.!
object literal
const car={
type:"BMW",
price:"50000$",
wight:"1500kg",
speed:"300km/h"
};
console.log(car);
// natija - {type: 'BMW', price: '50000$', wight: '1500kg', speed: '300km/h'}
object construktor
const person=new Object();
person.fName="Alexander";
person.lName="Noah";
person.face='have round face';
person.weight='120kg';
person.height='180sm';
person.job='BodyBuilder';
console.log(person);
// natija - {fName: 'Alexander', lName: 'Noah', face: 'have round face', weight: '120kg', height: '180sm', job: 'BodyBuilder'}
Top comments (0)