Find the Missing Number | getMissingNo takes list as argument ; Driver Code
function getMissingNo ( a , n ) { let n_elements_sum = Math . floor ( n * ( n + 1 ) / 2 ) ; let sum = 0 ; for ( let i = 0 ; i < n - 1 ; i ++ ) sum += a [ i ] ; return n_elements_sum - sum ; } let a = [ 1 , 2 , 4 , 5 , 6 ] ; let n = a . length + 1 ; let miss = getMissingNo ( a , n ) document . write ( miss ) ;