Big O notation with JavaScript examples