Skip to content
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

Miguel Garcia #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Miguel Garcia #175

wants to merge 1 commit into from

Conversation

garcia13
Copy link

No description provided.

function shoutForLoop() {}
function shoutForLoop(array) {
let array2 = []
for (let i = 0; i < array.length; i++)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget the brackets

Comment on lines +94 to +97
for (let i = 0; i < nums.length; i++) {
if (numSmall[i] < nums)
return numSmall
}}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The number 15 will pass this else if statement but it shouldn't because it is also divisible by 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants