Kyle walks through the solution to exercise 4. The solution is located in the file ex4-fixed.js.
- So let's talk about exercise four.…Let's start from the bottom.…Let's say that we wanna tag our strings…so we wanna put upper in front of it.…Our expressions need to look like this,…so we're going to say dollar sign name,…and then dollar sign Twitter,…and then dollar sign,…is it classname?…Yeah.…
So there's our string literal.…It needs to match this particular string…so you can see it needs to be able to pull in those…and uppercase the values.…So, let's do that.…Let's write a tag function to do that.…We start out with an empty string.…We do a for loop.…We say if I is greater than zero,…meaning I'm dealing with the values,…I wanna add and catenate onto the string…values of I minus one…but I wanna call toUpperCase on them.…
And then I want to…add it…strings of I…and return my string.…Let's test it and see if that worked.…And we got true.…So, there's our tag function.…
Questions about exercise four?…Yes.…- [Man] I was trying to use map instead of a for loop…but I couldn't get it to work.…- Okay, so map, this isn't the functional class…
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.