Menu
Coddy logo textTech

8. Missing Number

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

challenge icon

Challenge

Easy

Write a function to find the missing number in an array of integers from 1 to n.

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

Try it yourself

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

All lessons in 30 Days of Logic Building in Javascript