Syntax
02.2 Let and Const0:25
03. Quiz: Using Let and Const (1-1)00:00
04. Template Literals0:08
04. Template Literals 200:00
04. Practice00:00
05. Quiz: Build an HTML Fragment (1-2)00:00
06. Destructuring
06. Quiz 1
06. Destructuring 2
06. Quiz 2
07. Quiz: Destructuring Arrays (1-3)00:00
08. Object Literal Shorthand00:00
09. Lesson 1 Checkup00:00
10. Iteration00:00
11. Family of For Loops
12. For…of Loop00:00
13. Quiz: Writing a For…of Loop (1-4)00:00
14. Spread… Operator00:00
14. Practice00:00
15. …Rest Parameter00:00
16. Quiz: Using the Rest Parameter (1-5)00:00
17. Lesson 1 Summary00:00
Functions
02. Arrow Functions00:00
02. Quiz
03. Using Arrow Functions
03. Quiz 1
03. Using Arrow Functions 2
03. Quiz 2
04. Quiz: Convert Function into an Arrow Function (2-1)00:00
05. Arrow Functions Recap00:00
06. Arrow Functions and the00:00
07. “this” and Regular Functions
07. Quiz
08. “this” and Arrow Functions
09. Default Function Parameters
09. Quiz
10. Defaults and Destructuring
10. Quiz
11. Quiz: Using Default Function Parameters (2-2)00:00
12. Class Preview
13. JavaScript’s Illusion of Classes00:00
14. JavaScript Classes
15. Convert a Function to a Class00:00
16. Working with JavaScript Classes
16. Quiz
17. Super and Extends
18. Extending Classes from ES5 to ES600:00
19. Working with JavaScript Subclasses
20. Quiz: Building Classes and Subclasses (2-3)00:00
21. Lesson 2 Summary00:00
Built-ins
02. Symbols Intro00:00
03. Symbols
04. Iteration & Iterable Protocols
05. Sets
06. Modifying Sets
07. Working with Sets
08. Sets & Iterators00:00
09. Quiz: Using Sets00:00
10. WeakSets00:00
11. Quiz: Working With WeakSets00:00
12. Maps00:00
13. Creating & Modifying Maps
14. Working with Maps
15. Looping Through Maps
15. Practice00:00
16. WeakMaps00:00
17. Promises Intro00:00
18. Promises
19. More Promises00:00
20. Proxies Intro00:00
21. Proxies
22. Proxies vs. ES5 Getter/Setter
23. Proxies Recap
24. Generators
24. Quiz
25. Generators & Iterators
25. Quiz
26. Sending Data into/out of a Generator
26. Quiz
27. Lesson 3 Summary00:00
Professional Developer
02. Old and New Browsers
03. ES6 Specification
04. Supported Features
05. The Web is Eternal0:39
06. Polyfills0:52
07. Using Polyfills
07. Quiz
08. Polyfill Walkthrough00:00
09. Other Uses for Polyfills
10. Transpiling00:00
10. Quiz
11. Using Babel
12. Transpiling Walkthrough00:00
13. Transpiling Recap00:00
14. Course Summary00:00
02. Let and Const
There are now two new ways to declare variables in JavaScript: let and const.
Up until now, the only way to declare a variable in JavaScript was to use the keyword var
. To understand why let
and const
were added, it’s probably best to look at an example of when using var
can get us into trouble.
Take a look at the following code.
Hoisted to the Top
ReferenceError: freezing is not defined
Grab a jacket!
undefined
It’s a shorts kind of day.
SOLUTION:
undefined
Hoisting
Hoisting is a result of how JavaScript is interpreted by your browser. Essentially, before any JavaScript code is executed, all variables are “hoisted”, which means they’re raised to the top of the function scope. So at run-time, the getClothing()
function actually looks more like this…
INSTRUCTOR NOTE:
Before the function is executed, all variables are hoisted to the top of the function scope. So what’s our solution?