Fastest way to sum up number 1 to n
n * ( n + 1 ) / 2
Sum for the first n terms in an arithmetic series
n(a1 * a2) / 2 where a1 is the starting number and a2 is the finishing number
What is a JavaScript object?
A JS object is a collection of properties, where a property consists of a key value pair. The value can be data or a function.
When to use objects?
When order doesn’t matter.
When you need fast access /insertion / removal
Constant time O(n) for access, insertion, and removal
What is the Big O of searching an object?
O(N)
What is the Big O of getting an array of entries, keys or values?
O(N)
What is the Big O of checking if a property exists?
O(1)