Looping through elements
- Accesses length property every loop.
- Accesses length property only once and saves it into a constant.
- Uses forEach method.
Removing an element of an array
- Manually looping through each of the element to create a new array.
array.splicemutates the original array. So these two have different use cases. http://jsben.ch/DA7U2 compares
array.filterand a regular
array.map vs for-loop
array.forEach vs for-loop
for-loop vs while-loop
Checking if object has a particular key
- strict comparison operator
Credits to who ever made it. I simply added a new code block.
Checking if an element exists in an array