I can't understand this exercise * javascript

Hello everyone ! So I am learning javaScript, it’s been tough to be honest, I can’t exactly understand how to start, and like are there definite rules in javascript to follow?
I am trying to solve this exercise, but I’m a bit confused what exactly should I do ?

first, I woulf say, figure out the steps, how would you solve it with pen and paper?

once you have a process that can give the correct answer with any pair of words, then think of how to translate that in javascript

1 Like

That’s so true, that’s why I feel like JavaScript requires critical and analysis thinking as much as it needs technical skills
I am trying , thank you for replying : )

To give some hints which methods would be useful here:

either a for loop or array methods like map or forEach

1 Like

To add to the list of hints
filter( )
indexOf( )
and tenary operator in addition to what @jsdisco has mentioned above.

But above all try to understand the problem, and you will eventually figure it out

1 Like

Very Helpful hints @jsdisco , Thank you so much :smile:

@OnazOnaz I’ve actually never heard of them before !! Thank you for introducing them to me :rose:

I’ve actually solved it that way! I tried to understand the required first. All your notes helped me
I will try solving it with other techniques that you’ve mentioned , that what amazes / confuses me about JavaScript , a lot of ways can lead to one result