What is the reason why this is not working?
**Your code so far**
var Map = function() {
this.collection = {};
this.size = () => {
return Object.entries(this.collection).length
}
this.has = (key) =>{
let keysOfCollection = Object.keys(this.collection)
if(keysOfCollection.includes(key)){
return true
}else{
return false
}
this.values = function (){
return Object.values(this.collection)
}
}
this.get = function (key) {
let entriesOfCollection=Object.entries(this.collection)
for(let i=0;i<entriesOfCollection.length;i++){
for(let j=0;j<entriesOfCollection[i].length;j++){
if(entriesOfCollection[i][0]===key){
return entriesOfCollection[i][1]
}
}
}
}
this.clear = function(){
return this.collection={}
}
};
let a = new Map()
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
Challenge: Create a Map Data Structure
Link to the challenge: