What's the difference between set and add?
Hello, my question is in the title :) Thank you very much.
set is the method you use to add a new key-value pair to a
add is the method you use to add a new unique value to a
Neither object has the other's method (
Map doesn't have an
Set doesn't have a
set method). It's just how they are named.
Couldn't agree more with Simmons Also, note that the add method in the Set prototype is what ensures the uniqueness of data