shamsmosowi / git-bot

0 stars 0 forks source link

broken code #35

Open bofeiw opened 1 year ago

bofeiw commented 1 year ago

Hi, my code doesn't work, please help

let x = 1;

x = (x++, x);

console.log(x);
// expected output: 2

x = (2, 3);

console.logs(x);
// expected output: 3
shamsmosowi commented 1 year ago

Hi,

It looks like your code is not working because you have used the wrong syntax. The syntax for incrementing a variable by one is x++ instead of x++, x. Similarly, the syntax for logging a variable to the console is console.log(x) instead of console.logs(x).

You can use the following code instead:

let x = 1;

x++;

console.log(x); // expected output: 2

x = (2, 3);

console.log(x); // expected output: 3

I hope this helps!