- 1
Why <br /> tag doesn't perform along with alert() function?
For code var x; { for(x=2;x<=1024;x*=2) alert(x+"<br />") ; }
10 Antworten
+ 2
It doesn't bring any changes, until you append another string to it instead:
var y = 42;
alert(x+"\n"+y);
... or put more than once to see that it introduces new empty lines (even only once, but that's not easily visible):
alert(x+"\n\n\n");
+ 2
// something like that?
var x, s = "";
for(x=2;x<=1024;x*=2)
{
s += x+"\n";
}
alert(s);
+ 1
try \n instead
+ 1
Because alert() window content text is not part of the html document, but part of the operating system, called through the browser ^^
As @Jeremy advices, use alert(x+"\n") instead ;)
+ 1
Absolutly not:
document.write() is a JS function to access to document API and write inside the html document ;P
0
<br /> tag still works with document. write() function which is also not part of HTML document but JavaScript.
document.write(x+"<br />")
@visph
0
because only single inverted comaa is used for tags
- 1
(x+"\n") and (x) perform similarly in above coding.
\n doesn't bring any changes.
@jeremy & @visph
- 1
https://code.sololearn.com/WZIZsdCNF99C/?ref=app
In this code we get all the output in single tabular form instead on using alert() function (as mentioned above in original question). we get each individual output in separate popup.
Can't we get all output in single popup.
@vipsh ; @jeremy
- 1
Have u read all the discussion (questions & answers) on this post.
Sure Single inverted comma matters here
@ayush