Skip to content
This repository has been archived by the owner on Nov 7, 2020. It is now read-only.

Solution with Arrays only #113

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

Conversation

Satjr
Copy link

@Satjr Satjr commented Nov 18, 2017

I thought it would be better not to use Objects to answer this since this is an exercice about Arrays.

I thought it would be better not to use Objects to answer this since this is an exercice about Arrays.
@zeckdude
Copy link

zeckdude commented Feb 8, 2018

This works too:

   var seen = [];
    var dupes = [];
    
    arr.forEach(function(value) {
      if (seen.includes(value) && !dupes.includes(value)){
        dupes.push(value);
      }
      seen.push(value);
    });
    
    return dupes;

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

Successfully merging this pull request may close these issues.

2 participants