Question: ```js
var num = prompt("Enter a number");

for (var sum = 0; sum <= num; sum++) {
  sum = sum + 1;
}
document.write(sum);
```

example when I enter 6 in the prompt it will sum 1+2+3+4+5+6 =21. but as of right now i can only print 123456 instead of 21.

Answer: 
The problem with your code is that you're using `sum` for the loop and for the answer. That's messing everything up. You can use a variable for the loop and another variable for the sum.

Maybe that works for you.

```js
var num = prompt("Enter a number");
var sum = 0;
for(var i = 1; i <= num; i++) {
    sum += i;
}
document.write(sum);
```
here is some change in your code.  

**note**: (+) is used to convert string-number type to number type

```js
var num = prompt("Enter a number");
const sum = Array.from(Array(+num + 1).keys()).reduce((prev, curr) => prev += curr, 0);
document.write(sum);
```