extending built-in classes
Last updated
Was this helpful?
Last updated
Was this helpful?
โข๏ธ Alertโ
Normally, when one class extends another, both static and non-static methods are inherited. ( ๐ JS.info โฉ Static properties and methods )
But built-in classes are an exception. They donโt inherit statics from each other.โ๏ธโ๏ธโ๏ธ
ๆฏ่ผ class B extends A
่ Date extends Object ็ไธๅ๏ผ
ไธ่ฌ็ class A, B๏ผๅฎๅไน้ๆ prototype ็้ฃ็ต๏ผๆไปฅ A ๆๆ็ static properties B ไน้ฝๆใ
ไฝ Date ่ Object ไน้ไธฆๆฒๆ้ฃ็ต๏ผๅ ๆญค้็ถๆ Object.keys()
ๆนๆณ๏ผไฝๅปๆฒๆ Date.keys()
ๆนๆณโ๏ธ