Mastering Loops in JavaScript: Why, What, and How