Sets
Sets are built in data structure that holds a list of unique values, where each value can occur only once within the set. In other words, a Set can’t contain duplicate values. It contains dandy methods, that allows us to either add elements to the set remove them or even check whether they exist or not.
Has Own property vs in operator
Object.hasOwnProperty(prop)
:
- Returns a Boolean indicating whether the object has the specified property as its own property.
- The hasOwnProperty() method checks if an object has a property of its own and is not inherited from its prototype chain.