程式碼之外,還有生活的藝術 前端工程師 / 攝影 / 生活紀錄
- 文章361
- 標籤210
標籤查看更多
分類查看更多
- Advanced Web Dev Quiz (27)
- Deep JavaScript Foundations v3 (69)
- Full Stack Fundamentals (47)
- Functional JavaScript First Steps (21)
- JavaScript Design Patterns (6)
- JavaScript Hard Parts v3 (50)
- JS地下城 (5)
- Testing Fundamentals (27)
- TypeScript Fundamentals (28)
- Web Performance Fundamentals (41)
- You Might Not Need a Framework (32)
- 學習經歷 (2)
- 生活亂談 (2)
- 程式筆記 (4)
Wen-Hsiu 的部落格
學習筆記或日常生活記錄,這裡混合 Dev 和 Life 的最新內容
361 篇2026-06-2611 分鐘閱讀
說明為何「讓 class 方法自動硬綁定」是一個壞主意:展示用 getter 加 WeakMap 實作自動綁定的複雜 hack,以及這個做法如何從根本上違背 JavaScript this aware 函式的動態設計本質。
Deep JavaScript Foundations v3
#JavaScript #frontendMasters #deepJavaScriptFoundationsV3 #ThisKeyword #Class 2026-06-2615 分鐘閱讀
介紹 ES6 class 語法的基本用法、extends 繼承與 super 相對多型。說明 class 方法傳遞為 callback 時同樣會遺失 this 綁定,以及用箭頭函式「修復」這個問題所帶來的自我矛盾代價。
Deep JavaScript Foundations v3
#JavaScript #frontendMasters #deepJavaScriptFoundationsV3 #ThisKeyword #Class 2026-06-2512 分鐘閱讀
說明物件字面值的大括號不是範疇,因此物件內的箭頭函式會直接向上查找到全域範疇。整理箭頭函式唯一值得使用的場景(需要詞彙 this 時)、var self = this 的命名問題,以及箭頭函式不是第五條 this 規則的收尾論點。
Deep JavaScript Foundations v3
#JavaScript #frontendMasters #deepJavaScriptFoundationsV3 #ThisKeyword #ArrowFunction 2026-06-2510 分鐘閱讀
釐清箭頭函式的 this 行為:它不是「硬綁定到父層 this」,而是根本不定義 this,讓 this 像普通變數一樣沿詞彙範疇向上查找。說明為什麼這兩種理解方式在 new 關鍵字的角落案例上會產生根本差異。
Deep JavaScript Foundations v3
#JavaScript #frontendMasters #deepJavaScriptFoundationsV3 #ThisKeyword #ArrowFunction 2026-06-2413 分鐘閱讀
介紹 this 的第四種規則:預設綁定。說明非嚴格模式下退回全域物件、嚴格模式下為 undefined 並拋出 TypeError 的原因,並整合四種規則建立判斷 this 的完整框架。
Deep JavaScript Foundations v3
#JavaScript #frontendMasters #deepJavaScriptFoundationsV3 #ThisKeyword 2026-06-248 分鐘閱讀
介紹 new 關鍵字作為第三種 this 綁定方式:說明用 new 呼叫函式時依序發生的四件事,以及為什麼 new 更像是劫持了函式、由關鍵字本身完成所有工作。
Deep JavaScript Foundations v3
#JavaScript #frontendMasters #deepJavaScriptFoundationsV3 #ThisKeyword 2026-06-2315 分鐘閱讀
介紹 this 的前兩種呼叫規則:隱式綁定(點號左側的物件)與明確綁定(.call / .apply)。說明傳遞函式導致 this 遺失的問題、.bind() 硬綁定的解法,以及 Kyle Simpson 對彈性與可預測性的設計取捨框架。
Deep JavaScript Foundations v3
#JavaScript #frontendMasters #deepJavaScriptFoundationsV3 #ThisKeyword 2026-06-2311 分鐘閱讀
介紹 this 關鍵字的核心概念:this 的值由函式的呼叫方式決定,與定義位置無關。說明 this 與動態範疇的概念對比,以及後續四種呼叫方式的學習路徑。
Deep JavaScript Foundations v3
#JavaScript #frontendMasters #deepJavaScriptFoundationsV3 #ThisKeyword 2026-06-2212 分鐘閱讀
介紹 ES6 原生模組語法的核心特性:預設私有、以 export 公開、以檔案為單位、單例行為。同時說明 TC39 與 Node.js 之間的相容性問題歷史,以及 Kyle Simpson 在課程錄製時選擇觀望的背景。
Deep JavaScript Foundations v3
#JavaScript #frontendMasters #deepJavaScriptFoundationsV3 #ModulePattern 2026-06-2211 分鐘閱讀
介紹模組模式的核心要求:封裝(公私有區分)加上閉包(讓私有狀態持續存活)。說明命名空間與模組的根本差異、經典模組模式的兩個組成,以及 IIFE 單例版本與工廠函式版本的差異。
Deep JavaScript Foundations v3
#JavaScript #frontendMasters #deepJavaScriptFoundationsV3 #Closure #ModulePattern MIT Licensed | Copyright © 2025-present Wen-Hsiu's Blog
