Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to find missing number in integer array of 1 to 100 in javascript

 let array = new Array(100);                       // Sorted Array of 100
for (let a = 0; a < array.length; a++) {
   if(a===44){continue}
   else{ array[a] = a + 1;}
}
for(let n = 1; n < array.length; n++) { 
    if (! array.includes(n)) { 
        console.log('Missing integer', n); 
        break; // end program 
    } 
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: log error line node.js 
Javascript :: google places autocomplete empty latitude 
Javascript :: javascript string add new line 
Javascript :: loop through async javascript -4 
Javascript :: how to upload image in react js 
Javascript :: stdout javascript 
Javascript :: javascript tostring 
Javascript :: datatable on change event jquery 
Javascript :: jquery select2 multiple select all 
Javascript :: target child event 
Javascript :: what is after.js 
Javascript :: js add data in object 
Javascript :: discord.js if arguments null 
Javascript :: regex js 
Javascript :: hoisting in javscript 
Javascript :: jsonb_set 
Javascript :: js filter 
Javascript :: js ,flat 
Javascript :: nuxt get client windows size 
Javascript :: next js cookie 
Javascript :: testing a function in jest on click react 
Javascript :: new date 
Javascript :: jquery toastr 
Javascript :: angular 8 enable routing 
Javascript :: axios interceptors 
Javascript :: install react-native-safe-area-context 
Javascript :: age validation jquery 
Javascript :: react: fow to use find(to get the id of a element 
Javascript :: check if value is array 
Javascript :: Ping discord 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =