e
Size: a a a
e
Я
АН
U
S
for (let n = 1; n <= 100; n++) {совпадают одновременно несколько условий if, поэтому и выводится JohnRickJohn and Rick
let output = "";
if (n % 3 == 0 && n % 5 == 0) output += "John and Rick";
else if (n % 3 == 0) output += "John";
else if (n % 5 == 0) output += "Rick";
console.log(output || n);
}
€
U
for (let n = 1; n <= 100; n++) {совпадают одновременно несколько условий if, поэтому и выводится JohnRickJohn and Rick
let output = "";
if (n % 3 == 0 && n % 5 == 0) output += "John and Rick";
else if (n % 3 == 0) output += "John";
else if (n % 5 == 0) output += "Rick";
console.log(output || n);
}
S
U
VC
U
VC
U
VS
VS
P
I
T
ВБ
PK