-
Notifications
You must be signed in to change notification settings - Fork 39
Finished final assessment (Jordan) #57
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: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,8 +7,9 @@ | |
| */ | ||
|
|
||
| function numberOfDigits() { | ||
|
|
||
| function numberOfDigits(n) { | ||
| let i = n.toString() | ||
| return i.length | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How can you condense this code to look cleaner? Consider chaining and implicit returns. |
||
| } | ||
|
|
||
| module.exports = numberOfDigits | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,8 +14,18 @@ | |
| * | ||
| */ | ||
|
|
||
| function removeVowels() { | ||
|
|
||
| function removeVowels(str) { | ||
| let i = 0 | ||
| let vowelsRemoved = '' | ||
| while(i < str.length) { | ||
| if((str[i] !== 'a') && (str[i] !== 'e') && (str[i] !== 'i') && (str[i] !== 'o') && (str[i] !== 'u')) { | ||
| if((str[i] !== 'A') && (str[i] !== 'E') && (str[i] !== 'I') && (str[i] !== 'O') && (str[i] !== 'U')) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explore using the .includes() method to make this function more readable. |
||
| vowelsRemoved = vowelsRemoved + str[i] | ||
| } | ||
| } | ||
| i++ | ||
| } | ||
| return vowelsRemoved | ||
| } | ||
|
|
||
| module.exports = removeVowels | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,8 +11,19 @@ | |
| * 17 is also replaced with 'BOOM' because it contains a 7. | ||
| */ | ||
|
|
||
| function sevenBoom() { | ||
|
|
||
| function sevenBoom(n) { | ||
| let arr = [] | ||
| let i = 1 | ||
| while(i <= n){ | ||
| if(((i % 7) === 0) || (i % 10) === 7){ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider what would happen to the numbers 70-79. Would you receive the word "BOOM" with every number that contains 7? |
||
| arr[i-1] = "BOOM" | ||
| } | ||
| else{ | ||
| arr[i-1] = i | ||
| } | ||
| i++ | ||
| } | ||
| return arr | ||
| } | ||
|
|
||
| module.exports = sevenBoom | ||
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.
Which array method can you use to return a new array with updated information inside? This array method will replace the two loops you have here.