- Accesses length property every loop.
- Accesses length property only once and saves it into a constant.
- Uses forEach method.
array.splice
.array.filter
.- Manually looping through each of the element to create a new array.
- Unlike
array.filter
,array.splice
mutates the original array. So these two have different use cases. http://jsben.ch/DA7U2 comparesarray.filter
and a regularfor-loop
.
in
operator- strict comparison operator
Object.hasOwnProperty
object.key
expression
Credits to who ever made it. I simply added a new code block.
array.indexOf
array.includes
- for-loop
- while-loop