Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let arrNum = [],
- arr = [],
- n = Math.round(Math.random() * 10);
- n % 2 === 1 ? n += 1: n = n;
- for(let i = 0; i < n; i++) {
- arrNum[i] = i;
- let a = Math.round(Math.random() * 10);
- a = -a;
- arr[i] = a;
- };
- console.log(arr);
- console.log(arrNum);
- n = n / 2;
- console.log(n);
- for(let i = 0; i < n; i++) {
- let b = Math.round(Math.random() * n),
- c = Math.round(Math.random() * 1000);
- arr[b] = c;
- arrNum = arrNum.filter(item => item != b);
- };
- console.log(arr);
- console.log(arrNum);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement