Transcript from the "Array Methods Q&A" Lesson
[00:00:00]
>> Brian Holt: Yeah.
>> Speaker 2: So, looking ahead, how long do you think it'll take before JavaScript just lets you say strings.map to uppercase? [LAUGH] Cuz that's what I wanna do [LAUGH]
>> Brian Holt: I mean, we could. This is gonna be way more gross, but you could totally do strings. Let's say aconst x = this is some thing.
[00:00:26]
So, I can say x.split.
>> Brian Holt: Split allows me to split this string into an array of characters, and then I can map s to s.toUpperCase()). Okay, now everything in here is uppercase, and then here I'm just going to join.
>> Brian Holt: Now this was absolutely pointless, but I enjoyed it [LAUGH]
[00:01:11]
>> Brian Holt: But again, this is kind of the fun parts of the more functional style of programing. You have these transformations that kind of take place over line by line.
>> Brian Holt: And we can even put something in here. There's one called filter.
>> Brian Holt: So filter takes an array, and whatever you return true and stays in the array, and whatever you return false on removes from the array.
[00:01:46]
So let's say we're super against having Is in our strings so we wanna filter out all the Is, so I could say this would take in some string and it returns that S is not equal to I.
>> Brian Holt: And now all of my Is are gone.
>> Brian Holt: So this looks weird right?
[00:02:22]
This is exclamation.= equals, but it's combining those together into that thing.
>> Brian Holt: Did I talk about not equals yesterday? I probably didn't, did I? Okay, worth talking about, [LAUGH]
>> Brian Holt: Let's talk about them.
>> Brian Holt: I think it's pretty, hopefully implicit.
>> Brian Holt: So we talked about equal equals right, and triple equals, so if triple equals two, then console.log these are equal.
[00:03:11]
>> Brian Holt: Right? We got there. This is just three equal signs next to each other, but now I wanted to ask, are they not equal to each other, so I'll do != equals, okay? So as two not equal to three, these are not equal.
>> Brian Holt: So, just replace one of the equal signs with an exclamation point and that'll ask the question, are these things not equal?
[00:03:40]
Make sense?