Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

find the missing value in an integer array javascript

let a = [5, 7],
  count = 10,
  missing = []

for (let i = 1; i <= count; i++) {
  if (a.indexOf(i) === -1) {
    missing.push(i)
  }
}
console.log(missing)
Comment

PREVIOUS NEXT
Code Example
Javascript :: payload too large nodejs 
Javascript :: console.log color terminal 
Javascript :: exit program js 
Javascript :: mongodb create database with username and password 
Javascript :: how to flatten array with reduce in javascript 
Javascript :: node redis json push to array 
Javascript :: combinantion of single array in node js 
Javascript :: regex diferent of 
Javascript :: reactjs absolute import 
Javascript :: socket io leave all rooms 
Javascript :: loop through json object javascript 
Javascript :: convert base64 to uint8array javascript 
Javascript :: javascript scroll down 
Javascript :: js ask before close chrome 
Javascript :: js upload json 
Javascript :: vuejs watch sub property 
Javascript :: how to get only month and year in js 
Javascript :: javascript check if is array 
Javascript :: datatable columns with nullable fields ajax 
Javascript :: map function react not appearing 
Javascript :: change browser image react 
Javascript :: chart js laravel mix 
Javascript :: jquery populate select from json 
Javascript :: find an object in an array of objects javascript 
Javascript :: javascript find number in string 
Javascript :: axios multipart/form-data 
Javascript :: mysql json change key 
Javascript :: moment check days of difference between days 
Javascript :: how to concurrently run angular and node 
Javascript :: REMOVING EMPTY ARRAY INDEX 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =