You can create a set and add object to the set. JavaScript Set of objects loot like same as a normal object but entries have a value of the object.
JavaScript Set of objects
A simple example code creates a set and add the object to it.
<!DOCTYPE html>
<html>
<body>
<script>
let s = new Set();
let a = {1: "A"};
let b = {2: "B"};
s.add(a);
s.add(b)
console.log(s)
console.log(s instanceof Set)
console.log(s instanceof Object)
console.log(s instanceof Array)
</script>
</body>
</html>
Output:
Do comment if you have any doubts or suggestions on this JS set topic.
Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version