JavaScript Inbuilt Data Structures
In my previous JavaScript data structure series articles, I wrote about data structures that you can customize. In this article, we will review the built in data structures of JavaScript. Arrays are part of built in data structure in JavaScript and so are Objects. ECMAScript 2015 specification introduced two new types of iterable objects: Maps and Sets. Let us take a look at each of them below

OBJECTS
Objects are key value pairs of unordered data. Objects can have functions and methods which can be referred using dot or bracket notation. You can access objects using their properties.
Here are some of the characteristics of objects in JS
- Objects can be iterated using “for-in” loop.
- Keys must be unique.
- Values need not be unique.
- Multiple properties can have the same value in an object.
code snippet

Objects operations & Big O
- Searching by value — O(n)
- To add, delete and accessing — O(1)
SET
Set is a keyed collection of data. Since there are lists, they do not have indices like arrays. When you want to extract unique collection, then a Set can be used. Some of the characteristics of sets are
- They are dynamic in size.
- Insertion order is not preserved.
- Deleting and find in Set is super fast!
- Use when order does not matter for you.

code snippet

Set operations & Big O
- add( ), delete( ) and has( ) in Set data structure has a time complexity of O(1).
MAPS
Maps are similar to sets which contains ordered data. Here are the properties of maps
- Maps can be anything including array or an object itself.
- Maps are used only for specific use cases especially retrieving and deleting data.
- Can be Iterated using “for-of” loop.
In built methods
These are the common methods that is used with maps — has( ), get( ) and set( )
code snippet


These are the inbuilt data structures available in JavaScript. Hope you liked this quick overview of Set, Object and Map data structures. If you like this article give a clap!