The Set object lets you store unique values of any type, whether primitive values or object references.

So this will simply add 2 objects to Set since they do not have the same object references.

var mySet = new Set([{Name: "Ann"}, {Name: "Ann"}]);

console.log(mySet.size) // 2

You might as well use an array in this case.

So in this scenario to remove Ann (since we do not have an object reference) we would have to:

var mySet = new Set([1, 2, "abc", {Name: "Ann"}]);

console.log('With Ann size:', mySet.size)

mySet.forEach(x => x.Name === 'Ann' ? mySet.delete(x) : x)

console.log('Bye Ann size:', mySet.size)

Now consider this:

var ann = {Name: 'Ann'}
var mySet = new Set([ann, ann])

console.log('With Ann size:', mySet.size)

mySet.delete(ann)

console.log('Bye Ann size:', mySet.size)

So as you can see we are now dealing with object references and firstly the size is only 1 and the Set can now find ann reference and remove it with no issues.

Answer from Akrion on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-set-delete-method
JavaScript Set delete() Method - GeeksforGeeks
July 23, 2025 - // Create a new set using Set() constructor let myset = new Set(); // Append new elements to the set // using add() method myset.add(75); myset.add(12); // Print the modified set console.log(myset); // As 75 exists, it will be removed // and ...
🌐
Educative
educative.io › answers › what-is-the-setdelete-method-in-javascript
What is the set.delete() method in JavaScript?
In JavaScript, the set.delete() function is used to remove a specific element from a set.
Find elsewhere
🌐
Codecademy
codecademy.com › docs › javascript › sets › .delete()
JavaScript | Sets | .delete() | Codecademy
June 16, 2022 - The .delete() method removes a specified value from the Set and returns a boolean indicating whether or not the deletion was successful.
🌐
JSchallenger
jschallenger.com › javascript-practice › javascript-sets › delete-element-from-javascript-set
Delete element from Set | JSchallenger
JS · challenger · Home JavaScript Practice JavaScript sets · Delete element from Set · Write a function that takes a Set and a value as argument. If existing in the Set, remove the value from the Set. Return the result · Premium · reset · JavaScript ·
🌐
GoLinuxCloud
golinuxcloud.com › home › programming › javascript set remove element with delete()
JavaScript Set Remove Element: delete(), clear(), has()
June 17, 2026 - Learn how to remove an element from a Set in JavaScript using Set.delete(), check the boolean return value, clear all values, and remove object references.
🌐
GitHub
github.com › mdn › content › blob › main › files › en-us › web › javascript › reference › global_objects › set › delete › index.md
content/files/en-us/web/javascript/reference/global_objects/set/delete/index.md at main · mdn/content
```js-nolint · setInstance.delete(value) ``` · ### Parameters · · - `value` - : The value to remove from the `Set` object. Objects are compared by [reference](/en-US/docs/Glossary/Object_reference), not by value. · ### Return value · · `true` if a value in the `Set` object has been removed successfully.
Author: mdn
🌐
freeCodeCamp
forum.freecodecamp.org › curriculum help
Remove items from a set in ES6 - Curriculum Help - The freeCodeCamp Forum
December 28, 2020 - What is your hint or solution suggestion? On previous challenge we had to add items and i’ve done like: set.add(item) .add(item) .add(item) EX: set.add('Taco') .add('Cat') .add('Awesome') And it worked and i’ve past the challenge, but now with delete method this seems not to work: set.delete(item) .delete(item) instead i need to use the ‘set’ every time . set.delete(item) set.delete(item) Strange…
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-set-clear-method
JavaScript Set clear() Method - GeeksforGeeks
July 23, 2025 - // Create a new set using Set() ... modified set console.log(myset); console.log(myset.size); // The clear() method will remove // all elements from the set myset.clear(); // This will return 0 as there // are no elements ...
🌐
CoreUI
coreui.io › answers › how-to-clear-a-set-in-javascript
How to clear a Set in JavaScript · CoreUI
December 8, 2025 - Use the clear() method to remove all elements from a Set in one operation.
🌐
BigBinary Academy
courses.bigbinaryacademy.com › learn-javascript › set › deleting-values-from-a-set
Deleting Values From a Set - Learn JavaScript | BigBinary Academy
The `delete()` method removes an element from a Set. The `delete()` method takes the value of the element to be deleted as argument. If it finds the element inside the set and deletes the element, it returns `true`. It returns `false` if it was unable to find the element in the set.
🌐
TutorialsPoint
tutorialspoint.com › how-to-remove-all-the-elements-from-a-set-in-javascript
JavaScript - Set.clear() Method
September 18, 2019 - <html> <body> <script> const set = new Set(); set.add(5); set.add(10); set.add(12); set.add(18); document.write(`Result: ${[...set]} <br>`); document.write("Size of set: ", set.size, "<br>"); set.clear(); document.write("Size of set after removing elements: ", set.size); </script> </body> </html>
🌐
Techie Delight
techiedelight.com › home › java › remove one or more elements from a set in javascript
Remove one or more elements from a set in JavaScript | Techie Delight
July 7, 2026 - If we need to conditionally remove ... set and check if they match a certain condition. If they do, we can call the delete() function on the set to remove them....