let arr = [];
for (let i = 0; i <20; i++) {
let rand = Math.floor(Math.random() * 10) + 1
arr[i] = rand;
}
console.log(arr)
let evenNumbersArray = [];
let oddNumbersArray = [];
for (let i of arr) {
if (value % 2 == 0) {
evenNumbersArray += value
} else
{
oddNumbersArray += value
}
}
let sum=null;
for (let i=0; i < 10; i++) {
let value = +prompt("enter a number:", '');
if (!value || value >10) {
break
}
sum += value;
console.log(sum);
}
let arr = [];
for (let i = 0; i <20; i++) {
let rand = Math.floor(Math.random() * 10) + 1
arr[i] = rand;
}
console.log(arr)
let evenNumbersArray = [];
let oddNumbersArray = [];
for (let i of arr) {
if (value % 2 == 0) {
evenNumbersArray += value
} else
{
oddNumbersArray += value
}
}
Comments