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

Challenge http://www.freecodecamp.com/challenges/bonfire-return-largest-numbers-in-arrays has an issue #520

Closed
niftrr opened this issue May 26, 2015 · 1 comment

Comments

@niftrr
Copy link

niftrr commented May 26, 2015

Solution produces results equal to those asserted but but fails same tests, below. Code to replicate included, below.

assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]));Cannot read property 'eql' of undefined

(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([5,27,39,1001]);Cannot read property 'eql' of undefined

function largestOfFour(arr) {
maxArr = [];
maxNum = 0;
for (var x in arr) {
for(var y in arr[x]) {
if (arr[x][y] > maxNum) maxNum = arr[x][y];
}
maxArr.push(maxNum);
maxNum = 0;
}
return maxArr;
}

@terakilobyte
Copy link
Contributor

Fixed with a previous commit. Thanks for the heads up!

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

No branches or pull requests

2 participants