JSFiddle - React, Tailwind, and code Playground
by dshilkret
JavaScript
var arr = [1, 3, 6, 4, 1, 2];
function getNum(n) {
const set = new Set(n);
let i = 1;
while (set.has(i)) {
i++;
}
alert(i);
return i;
}
getNum(arr);
by dshilkret
var arr = [1, 3, 6, 4, 1, 2];
function getNum(n) {
const set = new Set(n);
let i = 1;
while (set.has(i)) {
i++;
}
alert(i);
return i;
}
getNum(arr);