Skip to content

Commit

Permalink
this+object prototypes: adding @nberardi Foreword
Browse files Browse the repository at this point in the history
  • Loading branch information
getify committed Jul 14, 2014
1 parent 40d4754 commit 8a64b41
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions this & object prototypes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[Table of Contents](toc.md)

* [Preface](../preface.md)
* [Foreword](foreword.md) (by [Nick Berardi](https://github.com/nberardi))
* [Chapter 1: *this* Or That?](ch1.md)
* [Chapter 2: *this* All Makes Sense Now!](ch2.md)
* [Chapter 3: Objects](ch3.md)
Expand Down
21 changes: 21 additions & 0 deletions this & object prototypes/foreword.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# You Don't Know JS: *this* & Object Prototypes
# Foreword

While reading this book in preparation for writing this foreword, I was forced to reflect on how I learned JavaScript and how much it has changed over the last 15 years that I have been programming and de‐ veloping with it.

When I started using JavaScript 15 years ago, the practice of using non-HTML technologies such as CSS and JS in your web pages was called DHTML or Dynamic HTML. Back then, the usefulness of JavaScript varied greatly and seemed to be tilted toward adding animated snow‐ flakes to your web pages or dynamic clocks that told the time in the status bar. Suffice it to say, I didn’t really pay much attention to Java‐ Script in the early part of my career because of the novelty of the im‐ plementations that I often found on the Internet.

It wasn’t until 2005 that I first rediscovered JavaScript as a real pro‐ gramming language that I needed to pay closer attention to. After dig‐ ging into the first beta release of Google Maps, I was hooked on the potential it had. At the time, Google Maps was a first-of-its-kind application -- it allowed you to move a map around with your mouse, zoom in and out, and make server requests without reloading the page -- all with JavaScript. It seemed like magic!

When anything seems like magic, it is usually a good indication you are at the dawn of a new way of doing things. And boy, was I not wrong -- fast-forwarding to today, I would say that JavaScript is one of the primary languages I use for both client- and server-side programming, and I wouldn’t have it any other way.

One of my regrets as I look over the past 15 years is that I didn’t give JavaScript more of a chance before 2005, or more accurately, that I lacked the foresight to see JavaScript as a true programming language that is just as useful as C++, C#, Java, and many others.

If I had this *You Don’t Know JS* series of books at the start of my career, my career history would look much different than it does today. And that is one of the things I love about this series: it explains JS at a level that builds your understanding as you go through the series, but in a fun and informative way.

*this & Object Prototypes* is a wonderful continuation to the series. It does a great and natural job of building on the prior book, Scope & Closures, and extending that knowledge to a very important part of the JS language, the `this` keyword and prototypes. These two simple things are pivotal for what you will learn in the future books, because they are foundational to doing real programming with JavaScript. The concept of how to create objects, relate them, and extend them to rep‐ resent things in your application is necessary to create large and com‐ plex applications in JavaScript. And without them, creating complex applications (such as Google Maps) wouldn’t be possible in JavaScript.

I would say that the vast majority of web developers probably have never built a JavaScript object and just treat the language as event-binding glue between buttons and AJAX requests. I was in that camp at a point in my career, but after I learned how to master prototypes and create objects in JavaScript, a world of possibilities opened up for me. If you fall into the category of just creating event-binding glue code, this book is a must-read; if you just need a refresher, this book will be a go-to resource for you. Either way, you will not be disappointed. Trust me!

Nick Berardi<br>
[nickberardi.com](http:https://nickberardi.com), [@nberardi](http:https://twitter.com/nberardi)

0 comments on commit 8a64b41

Please sign in to comment.