How do I loop with the <line/> tag inside the <svg> tag ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How do I loop with the <line/> tag inside the <svg> tag ?

I need to loop in the <line/> tag because I see my code very repetitive, when I create a repeated structure using the "test <br/>" argument, it works correctly as below. <script> for (i = 0; i <1000; i ++){ document.write ("test</br>"); } </ script> But when I put the same inside the <svg> tag and I change the argument to <line/> tag in order to remove the excess of the <line/> tag written, an error appears and does not work, it follows the code that I put. <script> for (i = 0; i <1000; i ++){ document.write ("<line/>"); } </ script> Below is my code so you can see this situation. https://code.sololearn.com/WV0TK1535JrF/?ref=app

31st Aug 2018, 12:32 AM
José Guilherme
José Guilherme - avatar
1 Answer
+ 3
Puny Programmer , it did not work, but your suggestion of the code did not show an error, and I believe that the <line /> tags were created, but something is missing to display the lines, since in line 140 of the code js attribute values ​​are sent for the <line /> tag and if the tag did not exist, it would certainly make a mistake for the missing lines, I tried your suggestion and also Jay Matthews , but an error appears saying that the line is not function, both suggestions are good lines reasoning.
1st Sep 2018, 11:40 AM
José Guilherme
José Guilherme - avatar