Open
Conversation
| function shoutForLoop() {} | ||
| function shoutForLoop(array) { | ||
| let array2 = [] | ||
| for (let i = 0; i < array.length; i++) |
Comment on lines
+94
to
+97
| for (let i = 0; i < nums.length; i++) { | ||
| if (numSmall[i] < nums) | ||
| return numSmall | ||
| }} |
There was a problem hiding this comment.
Lets make sure we are using the curly brackets where appropriate. Rewrite your if statement to do something with the current smallest number
| function findSecondSmallest(nums) { | ||
| let secondSmallest = nums[0] | ||
| for(let i = 0; i <= nums.length -1; i++) | ||
| if (nums[i] <= secondSmallest) secondSmallest = nums [i] |
There was a problem hiding this comment.
you will need to add an extra condition to make sure that you are keep track of the second smallest number
| function findSecondLargest(nums) { | ||
| let secondLargest = nums [0] | ||
| for (let i = 0; i <= nums.length - 1; i++) | ||
| if (nums[i] >= secondLargest) secondLargest = nums [i] |
There was a problem hiding this comment.
Same goes here. Make sure you are keep track of the first largest AND the second largest.
Comment on lines
+133
to
+139
| function removeDups(nums) { | ||
| let Dups = []; | ||
| for (let i = 0; i < nums.length; i++) { | ||
| if (! Dups.includes(nums[i])) { | ||
| Dups.push(nums[i])} | ||
| } return Dups | ||
| } |
There was a problem hiding this comment.
Nice ! Don't forget to properly format your code so that it's easier to read and debug
| if (num % 3 === 0) { | ||
| arr.push("Fizz") | ||
| } | ||
| else if (num % 5 === 0) { |
There was a problem hiding this comment.
The number 15 will pass this else if statement but it shouldn't because it is also divisible by 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.