You Don't Know JS: this & Object Prototypes (Paperback)

Kyle Simpson

買這商品的人也買了...

商品描述

No matter how much experience you have with JavaScript, odds are you don’t fully understand the language. This concise, in-depth guide takes you inside JavaScript’s this structure and object prototypes. You’ll learn how they work and why they’re integral to behavior delegation—a design pattern in which objects are linked, rather than cloned.

Like other books in the “You Don’t Know JS” series, this and Object Prototypes dives into trickier parts of the language that many JavaScript programmers simply avoid. Armed with this knowledge, you can become a true JavaScript master.

With this book you will:

  • Explore how the this binding points to objects based on how the function is called
  • Look into the nature of JS objects and why you’d need to point to them
  • Learn how developers use the mixin pattern to fake classes in JS
  • Examine how JS’s prototype mechanism forms links between objects
  • Learn how to move from class/inheritance design to behavior delegation
  • Understand how the OLOO (objects-linked-to-other-objects) coding style naturally implements behavior delegation

商品描述(中文翻譯)

無論你對 JavaScript 有多少經驗,幾乎可以肯定你並不完全理解這門語言。這本簡明而深入的指南將帶你深入了解 JavaScript 的 this 結構和物件原型。你將學習它們的運作方式以及為什麼它們對行為委派至關重要——這是一種物件之間相互連結而非克隆的設計模式。

與「You Don’t Know JS」系列中的其他書籍一樣,這本書深入探討了許多 JavaScript 程式設計師通常會避開的語言中較為棘手的部分。掌握這些知識後,你將能成為真正的 JavaScript 大師。

透過這本書,你將:

- 探索 this 綁定如何根據函數的調用方式指向物件
- 了解 JS 物件的本質以及為什麼需要指向它們
- 學習開發者如何使用 mixin 模式在 JS 中偽造類別
- 檢視 JS 的原型機制如何在物件之間形成連結
- 學習如何從類別/繼承設計轉向行為委派
- 理解 OLOO(物件連結到其他物件)編碼風格如何自然實現行為委派