Freecodecamp: Return Largest Numbers in Arrays - should check for negative numbers

Created on 19 Feb 2017  路  11Comments  路  Source: freeCodeCamp/freeCodeCamp

Challenge Return Largest Numbers in Arrays.

On the automated tests for passing this exercise, you should also have a test with only negative numbers also, like: largestOfFour([[-1, -3, -6, -25], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);

If you don't do array.sort and try to find the max in each sub-array, if you init a tempMax with 0 for each sub-array, the test will validate. But that would be fake validate, since the max from first sub-array would return 0.

help wanted

All 11 comments

@Jamayk Thanks, this is a great addition! :+1:

Since you reported it, would you like to make a contribution to add another test case? Me and other contributors would be happy to guide you through the process! :smile:

@Greenheart Sure; I'm new around, just started a few days ago. Hit me :D

@Jamayk Glad to hear that!

CONTRIBUTING.md can help you get started.

When you're all set, add another test case (a string with the assertion) somewhere around these lines and make your commit. See the other test cases for reference.

If you have any questions, please come chat with us in the Contributors Chat Room.

Happy Coding! :smile:

@Greenheart Well, I think I did it; can you check please?
Thanks!

edit: there's some diff @ the end of file, but I didn't change anything. I'll have a look; should I commit again then or it's fine?

@Jamayk You added a new line at the end of the file, just go to the bottom of the file and press delete and you should be fine, just make sure the closing brace is still there. Also you submitted a commit against your forked version of the repo. Make sure you add this repo as the upstream.

You can do so by running this command:
git remote add upstream https://github.com/freeCodeCamp/freeCodeCamp.git
then
git push -u origin your-branch-name

@Jamayk Sorry for the late reply, I somehow lost your notification. I can check, if I can find it! :smile:

It seems like you have cloned (downloaded a copy of) the freeCodeCamp/freeCodeCamp repository instead of forking (creating a personal version of a repository) and then cloning your fork.

Please make sure to follow the steps of the contribution guidelines to use a common workflow - and let us provide better help :blush:

Reach out if you need anything!

@donofriov Thanks for helping out! :+1: :tada:

@Greenheart Hey man! I did fork it then changed it online (hence space problem and commit with wrong upstream).

I will make myself a proper setup and (in the meantime, I did read the full contribution guidelines) then I can contribute easier when I have the time and knowledge for it.

Will get back to you when I get a chance.

@Jamayk Ah, I see! Looking forward to hear from you :blush:

@Greenheart I think it's done; hardest part was making the project work on my local (windows), so I can test my solution, and also run the automated tests. 'A bit' outdated dev, so this was my first MongdoDB, Node installment, and my first PR on an Open Source project. Fingers crossed!

Now that I have everything working, I only need to keep my Fork updated, and I can contribute easier when possible.

@Jamayk Yeah, the development setup is by far the biggest barrier to contributing fixes to a project. I'm really happy that you saw it through and got this PR submitted! Great job! :smile: :1st_place_medal:

With a project like this, there's almost always something that can be done, so feel free to help out more if you want to :smile:

To keep your local clone of the project updated, all you need to do is to

  1. Make sure you're on branch staging (git checkout staging)
  2. Make sure to have the git remote called upstream set to the git-URL to the freeCodeCamp/freeCodeCamp repository. (git remote -v can be used to verify). If not, run git remote add <URL>.
  3. Run git pull upstream staging to pull down latest changes.

Then you're ready to create a new branch and work on a new PR :blush:

Was this page helpful?
0 / 5 - 0 ratings