let str = ""; for (let a = 1; a <= 100; a++) { if (a % 2 !== 0) { if (a === 99) { str += a; } else { str += a + ","; } } } console.log(str);