Array Methods - .filter exercise
Hope everyone is doing well!
I was able to complete all three parts of this exercise. I was just wondering if anyone could help explain something.
I had to use new Date for filtering the array of episodes shot after 2013. Originally, I did
episode => episode.air_date > "December 31, 2013"
but some dates that were supposed to be true ended up being false and not being console-logged. After googling to find answers, I found that it worked if I placed the target date as
new Date("December 31, 2013") and the episode.air_date as new Date(episode.air_date) and then used the comparison operator to filter the correct episodes out. Like I said, it worked in the end but I couldn't wrap my head around why the first way I set it up didn't work. If someone could elaborate, I would appreciate it 👍
6
7 comments
Valentina Guevara
5
Array Methods - .filter exercise
Developer Pro
skool.com/developerpro
Learn how to code. Make money. Have fun. Enjoy life.
Leaderboard (30-day)
powered by