What am I missing or doing wrong here? Loop

// DO NOT CHANGE THE LINE BELOW.
const n = prompt("Enter a number: ");

/*
TODO: Create a string of even numbers from 0 to n inclusively,
with a comma as separator between two consecutive
even numbers.
For example: if n = 10, the result is “0,2,4,6,8,10”
*/

let result = ‘’;

for (let i = 0; i < n; i++) {
result += $\n;
}

// DO NOT CHANGE THE LINE BELOW.
console.log(result)

Everything? You didn’t perform any checks to only log the even numbers and you aren’t concatenating result with the even numbers you’re supposed to be checking.

Thanks for reminding me I’m new to this. I am also not the brightest star in the sky.
I’ll work on your suggestions one at a time. Perform checks for even numbers.

for string interpolation, it should be
result += `${i},`;
/n is the nextline character (its for starting another line)

also, inclusive means including n
so
i < n
should be
i <= n

consider incrementing by 2, instead of by 1 [since even numbers are 2 apart]
(meaning changing the i++ to something else)

Thanks. I am still studying to find out what to do.

// DO NOT CHANGE THE LINE BELOW.
const n = prompt("Enter a number: ");

/*
  TODO: Create a string of even numbers from 0 to n inclusively,
  with a comma as separator between two consecutive
  even numbers.
  For example: if n = 10, the result is “0,2,4,6,8,10”
*/

let result = ‘0’; // given

for (let i = 0; i <= n; i++) {
  // check if i is an even number, hint use modulo
  // if yes, add to result string result += `,${i}`;
  // otherwise do nothing and continue looping
}

// DO NOT CHANGE THE LINE BELOW.
console.log(result)