Conversation
reneemeyer
left a comment
There was a problem hiding this comment.
Jonathan, this code uses wayyyy too many loops.You should be using at the most 1. Also please use es6 syntax. In addition the program is throwing an error on line 46. node 02week/pigLatin.js. Please fix the error, clean up your code, push back to this branch, and then I'll re-test.
|
|
||
| // Your code here | ||
| // Array will be the word argument as an array | ||
| var array = word.split(''); |
There was a problem hiding this comment.
don't use var, use const or let depending if you're going to re-assign.
| var array = word.split(''); | ||
|
|
||
| // Vowels going to test against | ||
| var vowels = ['a', 'e', 'i', 'o', 'u']; |
There was a problem hiding this comment.
don't use var, use const or let depending if you're going to re-assign.
| var vowels = ['a', 'e', 'i', 'o', 'u']; | ||
|
|
||
| // Create newWord var to hold reordered letters | ||
| var newWord = ''; |
There was a problem hiding this comment.
don't use var, use const or let depending if you're going to re-assign.
|
|
||
| // Loop through leters in word | ||
| for (var y = 0; y < word.length - 1; y++) { | ||
|
|
There was a problem hiding this comment.
Think of a way to only use one loop. 2 loops are unnecessary.
| if (word[y] === vowels[i]) { | ||
|
|
||
|
|
||
| for (var x = y; x < word.length; x++) { |
There was a problem hiding this comment.
Explain to me why you are using so many loops?
Checkpoint Rubric
This is the rubric that your instructor will use to grade your checkpoints. Please do not edit.
Checkpoint 1
Checkpoint 2
Checkpoint 3