Let's walkthrough the solution to the fourth code challenge.
For this challenge, we need to use the forEach method to iterate over 0:00 the alphabet array, which contains each of the letters in the alphabet, and 0:04 store each letter in the array noel except for the L character. 0:08 Let's start with copying and pasting the code for 0:12 this challenge into Atom in order to make the code easier to read. 0:15 To solve this challenge, I added the call to forEach method with anonymous call 0:21 back function using arrow function syntax. 0:26 So alphabet.forEach. 0:29 I used character for the current value parameter name. 0:32 And I included a set of curly braces to define a code block. 0:38 Then I added an if statement to ensure that the current character wasn't 0:42 the letter L. 0:46 So, if (character 0:47 !== 'L'. 0:52 And if the if statement evaluates the true, 0:56 I push the current character onto the noel array. 0:59 So noel.push(character);. 1:02 And that's my solution. 1:06 We'll see you after the next challenge. 1:08
You need to sign up for Treehouse in order to download course files.Sign up