const array = [];let num = 3;
for (let i = 0; i <= 10; i++) {if (i % 2 === 0) {array.push(num);} else {array.push(-num);}num += 3;}
console.log(array); //[3, -6, 9, -12, 15, -18, 21, -24, 27, -30]
const array = [];
let num = 3;
for (let i = 0; i <= 10; i++) {
if (i % 2 === 0) {
array.push(num);
} else {
array.push(-num);
}
num += 3;
}
console.log(array); //[3, -6, 9, -12, 15, -18, 21, -24, 27, -30]