You Don't Know JS
Course Description
Want to learn to code using JavaScript? This is a great place to start! In this course, you’ll start out with a tour of the basic building blocks programming like variables, loops, functions and operations. Then, you’ll go through the three main pillars of JavaScript: Types and Coercion for comparing values and converting between types, Scope and Closure for knowing where variables can be accessed, and JavaScript’s “this” and Prototype system for dynamic context.
This course and others like it are available as part of our Frontend Masters video subscription.
Preview
CloseWhat They're Saying
It's been such an eye opener getting to understand the foundational JavaScript concepts with the 3 pillars of JS: Types and Coersion, Scope and Closure, 'this' keyword & the Prototype system with the 'class' keyword. Excited to apply the concepts to my own projects.😁
![Munga](https://senjaio.b-cdn.net/public/media/bf411e62-8b23-4710-8a5c-607deba49a02_961f118a-fa5e-4dd8-9787-bfc338751414_1RFl0jKF_400x400.jpg)
Munga
MungaSoftwiz
I just finished 'Getting Started with JavaScript , v2' course. Explored cool stuff like type coercion best practices and went deeper into closures & prototypes.
Excited to take on more JavaScript challenges! 🩷
![Andreea Farcas](https://cdn.senja.io/public/media/3dd2011e-99fc-4a83-90e2-f23161136c92_b7163a4a-2584-4143-bf76-f837e6775203_RfVGFJr9_400x400.jpg?format=png)
Andreea Farcas
AndreeaFarcas98
Learn Straight from the Experts Who Shape the Modern Web
Your Path to Senior Developer and Beyond
- 200+ In-depth courses
- 18 Learning Paths
- Industry Leading Experts
- Live Interactive Workshops
Table of Contents
Introduction
Section Duration: 9 minutes
- Kyle Simpson introduces the course on beginning to program in JavaScript and demonstrates several basic parts of a program working together.
- Kyle gives an overview of what will be covered in the course, including a primer on the main concepts of programming and also the three pillars of JavaScript: types and coercion, scope and closure, and this and prototypes.
Programming Primer
Section Duration: 1 hour, 2 minutes
- Kyle presents examples of different kinds of values. Differences are given between primitive and non-primitive values, and between array indexes and object properties.
- Kyle presents examples of different kinds of operations that can be performed, including addition, subtraction and comparison. After explaining what each does, Kyle runs the code to show how they evaluate.
- Kyle demonstrates how the typeof unary operator can be used to reveal the type of a value, including number, string, boolean, undefined, and object.
- Kyle explains what variables are, walking through how to use the assignment operator to assign a variable's value and then how to access the value. Empty values and semicolons are also discussed.
- Kyle differentiates between expressions and statements and then counts the number of expressions in an example statement. Kyle later runs an expression and statement to show how they evaluate.
- Kyle introduces control flow in JavaScript in the form of if and else statements, and explains the power this gives to the programmer. Kyle then runs a program with an if else statement.
- Kyle introduces loops by describing for loops, for of loops, and while loops. After explaining why loops are used, Kyle then runs a while loop to demonstrate how the while loop is working.
- Kyle explains why it is useful to group code together into a function, highlights the parts of a function signature, and shows what a function evaluates to after changing its arguments and running it.
- Kyle instructs students to use the basic programming principles learned in previous lessons to work through an exercise on adding strings to an array, then looping through the array.
- Kyle live codes the solution to the exercise.
- Kyle summarizes the programming primer section of the course, suggests resources for learning more about mentioned concepts, and discusses what will be covered in the course next.
Types & Coercion
Section Duration: 33 minutes
- Kyle introduces primitive types by debunking the myth that everything in JavaScript is an object and then explains what it means for the type to belong to the value in JavaScript instead of the variable.
- Kyle explains what NaN is, when a NaN will be returned, how to test if a value is of the type NaN, and in what situations it is beneficial to test for NaN values.
- Kyle differentiates between situations where new should be used to create instances of object representations and when not to use new, and instead by omitting it allow for type conversion to occur.
- Kyle introduces coercion by explaining when it occurs, discussing how the plus operator is overloaded related to coercion, and walking through instances of number and string coercion.
- Kyle displays the list of falsy and truthy values in JavaScript, and explains how the falsy list can be used to know which values will become true or false during conversion to a boolean value. Examples are given in the form of if and while statements.
- Kyle argues for making types and type conversions obvious, and frames the quality of a program related to types in terms of the reader of the code.
- Kyle distinguishes between the double and triple equals, and dives into how each works under the hood related to type conversions. A case is made for not always choosing the triple equals.
- Kyle summarizes the section on types by advocating for critical thinking around how to use types in a program, when to allow type coercion, and when to disallow it.
Scope
Section Duration: 20 minutes
- Kyle introduces scope as the rules for where to look for things and walks through the process of how variables are being looked up in a few lines of code.
- Kyle explains how the two concepts around emptiness in JavaScript, undefined and undeclared, differ.
- Kyle defines what a function expression is and then performs side-by-side comparisons between named and anonymous function expressions to argue that naming increases readability.
- Kyle discusses when it is beneficial to use the IIFE pattern to create immediately invoked function expressions.
- Kyle explains how to use block scoping as a tool to selectively make variables available, with the let keyword protecting a value from being accessed in an outer scope.
- Kyle explains what it means for closure to occur in a program and how to use closure advantageously when passing functions to other functions.
this & Prototypes
Section Duration: 11 minutes
- Kyle demonstrates how the this keyword in JavaScript's dynamic context system references the execution context of a function call in order to access values that are specific to that function call.
- Kyle introduces prototypal inheritance in JavaScript through an example where a method is added to a constructor's prototype and is then available to instances created using the constructor.
- Kyle explains how the class keyword works in JavaScript by displaying code using the class syntax that achieves the same result as code that uses the prototypal inheritance pattern.
Practice
Section Duration: 16 minutes
- Kyle instructs students to build off of code from the first exercise by incorporating elements of types, scope and closure, and the this and prototypes system.
- Kyle live codes the solution to the exercise.
- Kyle reviews what was learned about the three pillars of JavaScript and gives tips about how to continue growing as a JavaScript developer.
Wrapping Up
Section Duration: 1 minute
- Kyle wraps up the course by encouraging students to go out and code in JavaScript using the tools learned in the course.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops