[SOLVED] Whale Talk Project - task 8

Hi! :slightly_smiling_face:

I tried to do ‘Whale Talk’ project in JS. Unfortunatly, it doesn’t work from the task 8. This is displayed :

ReferenceError: index is not defined
at Object. (/home/ccuser/workspace/learn-javascript-loops-P1/main.js:15:26)
at Module._compile (module.js:571:32)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
at bootstrap_node.js:542:3

I watched the help video and I’ve read my code again and again… but I found nothing.

const input = 'Les corgis ne sont pas des baleines.';
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++) {
    if (input[i] === vowels[j]) {
      if (input[i] === 'e') {
      } else if (input[i] === 'u') {
      else {


Do you see any mistake? :face_with_monocle:

Thanks a lot and have a good day! :blush:


You are trying to push data to an array using


When it needs to be input[i] instead of index[i].

You can see that since the errors informs you that the word index is not defined anywhere inside the code.

1 Like

Oooooh, my bad. It called “having one’s nose to the grindstone”… :sweat:
Thank you very much. :smiley:

1 Like