Javascript's most common functions Big-O Notation.

Davinder Kumar
2 min readApr 26, 2020

--

Let’s analyze how Object and Array work through the lens of Big-O.

Object Big-O

Object Big-O

Insertion, removal, and accessing of a key is constant time O(1). But searching is O(n). N is a number of keys.

Big-O of object Methods

Big-O of object Methods

Array Big-O

Array Big-O

Big-O depends on where you are inserting and removing the element, at the end of array insertion and removal is constant time 0(1)

Big-O of Array Methods

Big-O of Array Methods

--

--