Data Structures: Create a Set Class-remove method

Tell us what’s happening:
cannot implement remove function

Your code so far


function Set() {
// the var collection will hold our set
var collection = [];
// this method will check for the presence of an element and return true or false
this.has = function(element) {
  return collection.indexOf(element) !== -1;
};
// this method will return all the values in the set
this.values = function() {
  return collection;
};
this.add = function(el) {
  return this.has(el) ? false : Boolean(collection.push(el));
};
this.remove = function(el){
  if (this.has(el)) {
   
    collection.splice(collection.indexOf(ele),1)  
    
    return true
  }
  else{
   return false;
  }
 
};
this.size = function(){
  return collection.length;
};
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36.

Challenge: Create a Set Class

Link to the challenge:

First of all, click the “Reset All Code” button to start fresh. Then, only add code between the two comments at the bottom. DO NOT change anything else. The starter code shows you the syntax for adding methods to a class. So you’ll want to follow that same syntax for the two methods you need to add.

Now, after following all of the above, give it a try again and then if you are still stuck, paste your code in here again (wrapping it in triple backticks) and we’ll go from there.

UPDATE: Let me just clarify that when I click on the link to the activity it is using JS class notation and so I’m assuming it is also for you too.

i figured out the solution, there was some spelling mistake in my code