variable inside another variable
hi there i wanted to put this:
document.write("y = " + i);
inside another variable, like this:
s=s+"\"y = \" \+开发者_如何学编程 i";
but now, i variable is not variable, just a plain text.
how can i fix this? output would be
document.getElementById("output").innerHTML=s;
thank you
You do not pass to s
string a variable - just text i
. Try with:
s=s+"y = " + i;
You can also convert it to:
s += "y = " + i;
精彩评论