-
Notifications
You must be signed in to change notification settings - Fork 0
Class3 functions #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gh-pages
Are you sure you want to change the base?
Conversation
reneemeyer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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