Correct. Iteration is possible in the insertion order, but items are not indexed and they cannot be sorted unless converted to array beforehand. Maybe worth pointing out.
Agree. Sets also don't have array methods like map/filter/reduce and others. I just don't use Set/Map in my daily work and always forget what data structure is used for. By comparing Set to Array and Map to Object I want to create a mental connection in my head to remember the purpose of these data structures without looking in documentation.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Sets are also unordered lists of elements, unlike arrays.
Why? We can use forEach method on Sets to iterate the collection by insertion order.
Correct. Iteration is possible in the insertion order, but items are not indexed and they cannot be sorted unless converted to array beforehand. Maybe worth pointing out.
Agree. Sets also don't have array methods like map/filter/reduce and others. I just don't use Set/Map in my daily work and always forget what data structure is used for. By comparing Set to Array and Map to Object I want to create a mental connection in my head to remember the purpose of these data structures without looking in documentation.