Menu
Coddy logo textTech

12. Maximum Element

Lesson 13 of 31 in Coddy's 30 Days of Logic Building in Javascript course.

challenge icon

Challenge

Easy

Write a function to find the maximum element in an array.

  • Input: <strong>[3, 1, 4, 1, 5, 9, 2, 6]</strong>
  • Output: <strong>9</strong>

Try it yourself

function findMax(arr) {
    // write your code below 
    
}

All lessons in 30 Days of Logic Building in Javascript

Practice on your own: Online JavaScript compiler