Q:

How to modify a program to output the summation of an equation

Hi for one of my labs it is trying to tell me to do tasks such as, modifying 1+2+3+4+5+6+7+8+9+10= to output the summation, while also keeping it in one line rather than cascading down the page. This is what i have so far and i dont know how to finish it.
var y= ""
for ( x = 0; x < 11; x++ ) {
    y+= x + "+" + "";
}
console.log(y);

EDIT
var sum = 0;
var y = "";

for (x = 0; x < 11; x++) {
    y += x + "+" + "";
    sum += x;
}
console.log(y, sum);

A:

try like this
var y= ""
var temp=[]
for ( x = 0; x < 10; x++ ) {
    temp.push(x+1);
}

y=temp.join('+');
var sum=temp.reduce(function(a, b){return a+b;});
y+='='+sum
console.log(y);

EDIT
for more simple 
var y = ""
var sum=0;
var n = 10;
for (x = 0; x < n; x++) {
    var val=(+x + 1);
    sum += val;
    y += val;
    if (x < n - 1) y += '+';
}
y+='='+sum;
console.log(y);

suppose you have sequence
n=5 

means 1+2+3+4+5=15
n= 4

means 1+2+3+4=10 
Everytime after nth + is not repated
That's why if (x < n - 1) won't add + when x=4 as you are using x from 0

