Произведение четных. Вариант решения

var lastNumber = 5;
var multiplicationResult = 1;

for( var i = 1; i<= lastNumber; i++){
if(i%2 == 0){
multiplicationResult= multiplicationResult*i;
}
}

2 лайка

var lastNumber = 5;
var multiplicationResult = 1;

for (var i = 1; i <= lastNumber; i++) {
if (i % 2 == 0) {
multiplicationResult *= i;
} else {
continue;
}
}

let lastNumber = 5;
let multiplicationResult = 1;

for (i = 2; i <= lastNumber; i = i + 2 ) {
if (i % 2 === 0) {
multiplicationResult = multiplicationResult * i;
}
}

for (let i= 1; i<=lastNumber; i++) multiplicationResult *= !(i%2)? i:1

let lastNumber = 5;
let multiplicationResult = 1;

for (let i = 1; i <= lastNumber; i++) {
  if (i % 2 === 0) {
  multiplicationResult *= i;
  }
}
1 лайк
let lastNumber = 5;
let multiplicationResult = 1;

for (var i = 1; i <= lastNumber; i++) {
  if (i % 2 == 0) {
    multiplicationResult = multiplicationResult * i;
  }
  console.log(multiplicationResult);
}

тоже самое, только с выводом в консоль