Find the missing number in the array using JavaScript.

   const findMissingNumber = (arr) => {
       let numberCnt = arr.length;
       if(numberCnt < 1) return false;

       let sumTotal = arr.reduce((a, b) => a + b);

       numberCnt += 1;
       const naturalSum = (numberCnt * (numberCnt + 1)) / 2;
       return (naturalSum - sumTotal);
   }
   console.log(findMissingNumber([3, 6, 1, 2, 8, 4, 5]))
   const findMissingNumber = (arr) => {
       arr.sort()
       let missing = 0;
       for( let i = 0; i < arr.length ; i++) {
           if(arr[i] !== (i + 1)) {
               missing =  i + 1;
               break;
           }
       }
       return missing;
   }
   console.log(findMissingNumber([3, 6, 1, 2, 8, 4, 5]))