JavaScript Whale Talk Solution Confirmation and Question



let input = 'turpentine and turtles';
const vowels = ['a', 'e', 'i', 'o', 'u'];
let resultArray = [];

for (let i = 0; i < input.length; i++) {
  for (let j = 0; j < vowels.length; j++) {
    //console.log('j is ' + j);
    if (input[i] === vowels[j]) {
  if (input[i] === 'e') {
  if (input[i] === 'u') {


Can someone confirm if this solution is correct? A lot of the posts on the forum seem to ignore specific parts in the instructions. Even the YouTube video solution posted on the exercise seems to ignore this instruction:

Note, this statement belongs after the inner for loop block inside the outer for loop. This is because you only want to perform this check once for every letter in the input .

Thanks for any insight.

Well, does your solution do what it is expected to do? Ignore everyone else’s solution for now.

I believe it works as intended, so I guess the answer to my question is yes it’s correct and there are different ways of achieving the solution?

There you have your answer. If you are looking for confirmation that your solution is correct based off syntax, you will stray off the right path. Focus on solving the problem, then you can experiment with other solutions. Focus on bettering your solution. There will always be different ways of solving a problem.

1 Like