+ 1

what is the use of ' text"" ' and 'text i'

what is the use of ' text"" ' and 'text i' in the given code:- for (i=1, text=""; i<=5; i++) { text = i; document.write(i + "<br />"); }

7th Jun 2020, 9:02 AM
Kumar Sarthak
Kumar Sarthak - avatar
1 Resposta
+ 1
In my opinion there is no use, unless I am missing something or your code snippet is missing some context. The iteration variable i is being assigned to text, but not used. Omitting the text in the loop declaration and loop execution gives the same output.
7th Jun 2020, 10:58 AM
phil