# Clearing the set using Javascript

Web DevelopmentJavascriptFront End Technology

The clear method is pretty straightforward. We can just reassign the container variable to a new object and the set will now be empty. This can be implemented as follows −

## Example

clear() {
this.container = {};
}

You can test this using −

## Example

const testSet = new MySet();

testSet.display();
{ '1': 1, '2': 2, '5': 5 }
{ }