I have problem with one loop exercise. I have written 3 possible answers and my code failed each time. My counter failed, I have problem with the scope of variables and nested loops.
I have an array of food, and I have to find the one food with the best vowels to length ratio and console.log() it.
First I tried creating 3 variables two to compare with each other and one to store the result in it,that gave me undefined for parts of the array. I expected that food3 will have all the iteration of i , but it had only i[2], and food2 had i[1],i[undefined],i[3]
. In my second try had 2 variables, but my counter failed.
https://pastebin.com/iUS6hAVU
https://pastebin.com/kuE2SzFf
https://pastebin.com/MUMaiH72