Answer the question
In order to leave comments, you need to log in
Why is undefined displayed instead of a space?
function calculate(){
var str=document.getElementById("vvodA").value;
var i=0;
var s=new String(s);
var s1=new String(s1);
while (i<str.length)
{
if (str.charAt(i)!=' ') {
s+=str.charAt(i);
i++;
}
else
{
i++;
s1=s;
s=' ';
}
}
s=s.concat(s1);
alert(s);
}
Answer the question
In order to leave comments, you need to log in
var s=new String(s);
var s1=new String(s1);
it's not easier to do this:
var s= "",
s1= "";
I don't know what this new String is but I can assume that it should be like this var s1=new String("s1");
Well, at least bring your code, for the sake of decency and so as not to be telepaths)
It is obvious that you are clearly “shove something wrong” in this line)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question