Skip to content

Instantly share code, notes, and snippets.

@magicly
Created April 8, 2020 08:23
Show Gist options
  • Save magicly/c69b82db9837a65faccb2b3a6285c1e9 to your computer and use it in GitHub Desktop.
Save magicly/c69b82db9837a65faccb2b3a6285c1e9 to your computer and use it in GitHub Desktop.
const bushu = (n, arr) => {
if (n < 10) return;
if (n > 10000000) return;
let newArr = [];
for (let i = 1; i <= n; i++) {
if (arr.indexOf(i) == -1) {
newArr.push(i);
}
}
return newArr;
};
console.log(bushu(100, [1, 2, 3, 4, 7, 9, 10, 100]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment