Kyle walks through the solution to exercise 1. The solution is located in the file ex1-fixed.js.
- So, let's talk about exercise one.…Here we started off with a var X equals two.…We can kind of see in the scope of this program…that's sort of being used like a constant…so that's a place where you could make the argument…that it should be a const.…Fns is definitely not gonna be treated as a const…in the sense it's not gonna be treated as a constant…even though it might be reassigned,…we're gonna be adding to it,…so I think it would be super confusing…to declare fns as a constant…and then later in the code…start adding to the contents of it, okay?…You can but I don't think you should.…
So, that's why we're gonna go ahead…and declare fns as a var…because we're telling someone hey,…this thing is gonna be reused,…and I use a var here instead of a let,…again because fns is gonna be used across multiple scopes.…Alright?…Now, in the previous example I had an ify…and the only purpose of this ify…was so that I could make another var X…which was sort of my constant…in terms of how high up to go,…and there would be a collision there…
This course was created by Frontend Masters. It was originally released on 01/10/2017. We're pleased to host this training in our library.
- The arrow function
- Arrow function variations
- Closures and explicit blocks
- Default values
- Using the gather and spread operators
- Dumping variables
- Concise properties and methods
- Symbols, iterators, and generators
- Optimizing codes for the reader
Skill Level Intermediate
1. Arrow Functions
2. Block Scope
3. Default Values and the Gather/Spread Operators
5. Template Strings
6. Symbols, Iterators, and Generators
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.