This is my first pass at this challenge and I’ve got some other ideas for solving it, but I’m wondering why my code doesn’t fulfill the requirements. It looks as though my push is ignoring my if statement. Seems to me it should only be pushing the correct values into my new array but it’s pushing everything in. I’m obviously using the wrong approach, but could someone help me understand why this isn’t working? Thanks!
I know, I have to do major refinements to the way I write as I usually have tons more lines of code than the solutions provided. I always check the solutions after I finish mine and see how inefficient my code is. That said, 4 days ago I literally was just staring at the computer screen wondering how I was supposed to know how to solve any of these, and then something in my brain clicked (thank God). I’ll probably come back after I finish the entire Javascript certification and redo these with a focus on minimizing my code.