ayugioh2003 / today-i-learned

記錄每天看到的資訊(暫以前端技術為主)
7 stars 0 forks source link

javascript - Why is document.all falsy? - Stack Overflow #1626

Open ayugioh2003 opened 1 year ago

ayugioh2003 commented 1 year ago

網址

MDN

ECMA

TC39

W3C mail list

whatwg html spec

記錄原因

幫人校稿 JS 的書發現的一個 fun fact

JS 中所有型別的值都可以轉成布林值 而物件都會被轉型成 true 例如 Boolean({}) // true

但 DOM 中,有個物件是特例: document.all

Boolean(document.all) // false typeof document.all // 'undefined'

@@

觀念

學習點

相關資料