- Access - O(1)
- Insertion - O(1)
- Deletion - O(1)
- However, Searching is O(n)
In searching, we mean searching the object for a particular value. We would have to go through the whole object, checking each key if they have the value that we would want. So, the larger the object, the longer it would take to search for the particular value.
- Object.keys - O(n)
- Object.values - O(n)
- Object.entries - O(n)
- hasOwnProperty - O(1)
The reason why the first 3 helper methods are
O(n) is due to the fact that those methods would return an array, where the array's size is dependent on the size of the object. So, the larger the object, the longer it would take.
hasOwnProperty is similar to accessing an object, which is constant time (`O(1)`)