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

Accepting wrong output #14334

Closed
arunvkumr opened this issue Apr 10, 2017 · 2 comments
Closed

Accepting wrong output #14334

arunvkumr opened this issue Apr 10, 2017 · 2 comments

Comments

@arunvkumr
Copy link

arunvkumr commented Apr 10, 2017

Challenge Wherefore art thou has an issue.

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36.

Please describe how to reproduce this issue, and include links to screenshots if possible.

This is the code i wrote, the correct output should be [{ "a": 1, "b": 2, "c": 2 }], but my code produces output [ { b: 2 }, { a: 1, b: 2, c: 2 } ] which is being accepted.

My code:

function whatIsInAName(collection, source) {
  var keys = Object.keys(source);
  var arr = collection.filter(function(obj){
      for(var i = 0; i < keys.length; ++i)
        if(obj.hasOwnProperty(keys[i]) && obj[keys[i]] === source[keys[i]] && i == keys.length - 1)
        return true;
  });
  return arr;
}

whatIsInAName([{"b": 2 }, { "a": 1 }, { "a": 1, "b": 2, "c": 2 }], { "a": 1, "b": 2 });
@arunvkumr arunvkumr changed the title Accepting wrong output. Accepting wrong output Apr 10, 2017
@augmt
Copy link
Contributor

augmt commented Apr 14, 2017

Similar to #14057.

Tests for this challenge are too lenient on the main site but they're more robust in the beta.

@erictleung
Copy link
Member

@arunvkumr thanks for the issue and apologies it's taken so long to get to your issue. This does pass in the production live site, but it doesn't on the beta site (http://beta.freecodecamp.com/en/challenges/intermediate-algorithm-scripting/wherefore-art-thou). So this doesn't seem to be an issue anymore so I'll be closing this issue. If you still think it's an issue, feel free to comment back. Happy coding!

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

3 participants