<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
class KerwinSet{
constructor(){
this.items = {}
}
add(element){
if(!this.has(element)){
this.items[element] = element
return true
}
return false
}
delete(element){
if(this.has(element)){
delete this.items[element]
return true
}
return false
}
has(element){
return element in this.items;
}
clear(){
this.items = {}
}
size(){
return Object.keys(this.items).length
}
values(){
return Object.values(this.items)
}
}
const myset = new KerwinSet()
myset.add(100)
myset.add(200)
console.log(myset.items)
</script>
</body>
</html>