JavaScript 📜
October 6

Javascriptda Obyektlar

Javascriptda obyektlarni quyidagi yo'llar bilan yaratish mumkin:

  • Using an Object Literal
  • Using the new Keyword
  • Using an Object Constructor
  • Using Object.assign()
  • Using Object.create()
  • Using Object.fromEntries()

JavaScript has built-in constructors for all native objects:

  • new Object() // A new Object object
  • new Array() // A new Array object
  • new Map() // A new Map object
  • new Set() // A new Set object
  • new Date() // A new Date object
  • new RegExp() // A new RegExp object
  • new Function() // A new Function object

Note:

Math() obyekt bu ro'yxatda emas. Math global obyektdir. new kalit so'zi Math bilan ishlatilmaydi.

Object constructorga yangi metod ham property ham qo'shib bo'lmaydi