Mdn article Arrays #4: Test your skills

how would I go about making every item in the array that starts with ‘E’ using (startsWith); show in the console, which the console says isn’t a function.
Also I have already tried using the if statement or maybe i messed something up.

Hi @BenjiG178

startsWith() is a string method. You will need some kind of loop to go over all the elements in the array and use the method on each of them. A more elegant solution than an ordinary loop would be using filter() on the array.

I hope that gets you further. :slightly_smiling_face:

Michael

1 Like

Thanks!
I felt it would be weird to keep asking questions because you just answered one of them yesterday; I wonder what your (pov) of coming across the same person asking questions everyday is like :slightly_smiling_face:
like how do you react when you see it, be brutally honest

1 Like

No brutality needed while answering honestly in this case. :grin:

I’m volunteering on this forum for more than 1½ years now. As you may guess I’ve graded every exercise multiple times. So it feels refreshing to answer general questions about web technologies or questions about a certain aspect of an exercise. This may be the reason you received a speedy response to your questions. :sunglasses:

Sometimes, when digging deeper to give a good response I also learn something for myself. In the end I’m far away of being an expert on web technologies.

So, never feel weird for asking questions. Keep them coming and I’ll happily try to answer them. :slightly_smiling_face:

1 Like

Thanks! I ended up solving it; very surprisingly, This is one of my first times actually writing code and being able to get the exact result I needed.
I’m used to writing notes, but I never put it to practice. that’s why whenever I’m coding i literally forget everything and don’t know how things correlate together to get the result.


feels like a milestone :+1: getting this done!

1 Like

I’m very glad to hear that!

Believe me, you’re not the only one. :smile: I’m often looking up stuff. Either on MDN, the framework docu or my own previous code. If you’re not constantly using certain functions/concepts, it’s easy to forget how they exactly work.
I think the important thing is that you know that something exists in general and you “only” have to look up the details.

I have one small remark about your code: newArray is a bit of a misleading parameter name since it holds a string. It would be better to name it bird, item or similar. Finding good variable names is sometimes hard but always helpful in the future.

Fantastic!

1 Like