This course has been updated! We now recommend you take the Deep JavaScript Foundations, v3 course.
Transcript from the "Course Plan" Lesson
[00:00:00]
>> [MUSIC]
[00:00:04]
>> Kyle Simpson: So I'm gonna give you, this not the official title, but this is kind of the unofficial title for todays. This is a two day workshop, this is the unofficial title cuz, this is what I give when I give this one day talk is a standalone. I call it the What you need to know Parts, Advanced JavaScript, The What you need to know Parts.
[00:00:20] And I need to explain to you what my practice is gonna be. You should already get a flavor from that just from our discussion of looking at the spec. But I want you to understand what you should be expecting from today. So first of all I call it Advanced JavaScript.
[00:00:33] Does that mean that I expected you to be an advanced JavaScripter before walking in here, before joining online? No, that's not what I expect. What I do kind of recommend is that you're taking this course with at least maybe one to possibly two years of experience with JavaScript.
[00:00:48] And that's not a requirement, it's just a recommendation that you at least be familiar with the language. So we could call that sort of somewhere between beginner and intermediate in terms of your experience, kind of your base experience. I'm not gonna teach you how for loops work, I'm going to expect that you understand stuff like that.
[00:01:02] But I am gonna take things which you might consider to be basics. Things like lexical scope, which you just sort of, maybe you never heard it called that, but you just sort of understand kind of intuitively. We're gonna take that stuff and break it down into extremely deep detail.
[00:01:17] I'm gonna give you compiler terminology here in a few minutes. And that may feel a little uncomfortable, because some of us aren't quite like me. I write compilers for fun, but not everybody does that. So understanding that kind of deep terminology and concepts can be difficult. And so when I say Advanced JavaScript, it really is kind of the advanced basics.
[00:01:36] We're gonna take the basic things that I think are requirements for you to understand before you can be an Advanced JavaScripter. There's a whole bunch of stuff that you could spend ten or more years in this industry writing JavaScript and never actually understand. And there's a lot of people that will attest to that.
[00:01:52] I've written JavaScript for a decade and I didn't understand how closures work. It's just a fact, because JavaScript's so approachable, it's so easy to get up and going. And you can spend your entire career never being forced to actually learn it. I'm gonna force you today to actually learn how that stuff really works.
[00:02:06] So some people would define Advanced JavaScript as broad as possible. Let's look at every possible acronym and framework and hot pattern of the day and let's talk about all these possible things. And there's lots of great courses, Marc's got lots of great courses and there's lots of other great content out there.
[00:02:22] Infinite numbers of blogs and books that talk about that sort of stuff, that's not what today is. Today is gonna be a very narrow scope of what we're gonna discuss, but we're gonna go extremely deep with it. We're gonna dig our teeth deep into this stuff, so that's what I mean by advanced.
[00:02:35] And when I say the what you need to know parts, obviously I'm making a play off of Crockford's The Good Parts. But when I say the what you need to know parts, I'm going to explain to you when we talked about the this keyword. Or when we talk about the definition of what closure means.
[00:02:49] I'm going to explain to you in what I hope is more understandable terms than just quoting to you the spec. I'm not just gonna show you a bunch of screenshots of what the spec says. Although I think it's important to be aware of what the spec says, so that you're not saying things incorrectly.
[00:03:04] My focus here is to give you practical takeaways on things, so this is the what you need to know definitions for these things, rather than necessarily the academic ones. There will be people that will disagree with me and say no, no, no, that's not a type. Or no, no, no, that's not really accurate about closures.
[00:03:18] And my answer to that is to just shrug and say, well. I'm not interested in being academically formal, I'm more interested in giving us practical understanding.
>> Kyle Simpson: Okay. So, without any further ado, this is gonna be our first discussion. Point we're gonna spend a good portion of the morning talking about scope and closures.
[00:03:39] So we're gonna start by talking about Nested Scope, we're gonna move into a discussion of Hoisting. May or may not of ever heard of what hoisting is. Now I'm gonna do something kind of interesting, cuz if you don't understand anything about these mechanisms. It should seem strange to you that third item on the list, when I talk about the this keyword.
[00:03:54] Sort of injected right in the middle of the discussion about lexical closures. Maybe that seems weird, maybe it doesn't. If it doesn't seem weird to you, I hope it does seem weird to you by the time we get there. Because the point is actually that these are completely opposite mechanisms.
[00:04:08] So the reason I stick it right there in the middle is to make it really obvious, the contrast, the difference between them. So this is an unusual approach. In the books, I didn't deal with a this keyword inside of the scope in closures cuz my editor was like, no, that's too weird.
[00:04:21] But when I'm doing training, I can do whatever I want and I think it's better to talk about it there, so that we can contrast. So that's intentional that it's kind of weird, but then we'll jump right back into a discussion of closure. And I should also say, there will be a fair amount of lecturing.
[00:04:35] I'm gonna do a bunch of talking and thing's like that, but there is also as you know, there are five exercises. Each one of those is designed to be anywhere from seven or eight minutes up to fifteen minutes of free time that you're working on something. Or I give you the exercise, I give you some time to work on it.
[00:04:52] I shut up for a little bit and then I come back and kind of give you a guided solution tour if you will, kind of how I would approach things. There's no right answer to any of this stuff, but I do provide in each one of those exercises, a fixed version of the files that gives you my example of how I would have done it.
[00:05:08] So at a later time you can come back and say, well how did Kyle do it? But that doesn't necessarily mean that's the only way to do it, so there will be exercises for you to do. Now if we contrast that to what we're gonna deal with tomorrow, there's comparatively a lot less lecture tomorrow and a whole bunch of just hacking at the code terminal.
[00:05:23] So there's very few slides, and we spend most of our time just kind of live coding, tomorrow. So if you're really looking for that code and you feel like I'm lecturing and I'm too much boring, just hold off until tomorrow. If you like the lecture stuff, there'll be plenty of that today.
[00:05:36] The goal for today is to give you a really, really solid foundation of understanding about the core mechanisms that JavaScript relies upon. So that when we talk about scope, I mean when we talk about something inside of node.js. And I just assume that you understand what lexical scope means when I talk about a module the scope.
[00:05:55] I'm gonna assume that you understand what that means and I can't assume that today. Even if I looked at some of the responses from the pre-event surveys. Some people felt really confident with the stuff and other people are coming in with not quite so much confidence. So the goal is that everybody walks away from today with that confidence.
[00:06:11] So that when we talk about node tomorrow, there aren't questions about those core mechanisms, we can really focus on the thing. It's kind of one of those hidden secrets about the node world. A lot of people tend to think that if you talk about a scale of one to five, like my understanding of JavaScript is a two out of five.
[00:06:30] Then my understanding of node is two out of five and in reality, they're actually kind of skewed. You can have an understanding three, in JavaScript, out of five and you can still be at a one level understanding in node. Because node requires you to understand a whole bunch more of the language than you've ever been forced to understand really before.
[00:06:48] Or you get yourself into trouble. So they're kind of skewed and that's why we set this up as a two day workshop. So that we can make sure that we fully understand JavaScript before we talk about node.