Skip to main content

08object

Object#

存取 JavaScript 的物件內容時有兩種寫法:點記法 (dot notation) 和括號記法 (bracket notation)。

dot notation 寫起來比較簡單,平常會優先使用,但在遇到今天這種,你想要根據情況動態呼叫不同的方法時,你必須要使用 bracket notation,才能用變數 this.visibility 來決定要呼叫 filters 的哪一個方法: