0
How can I move to the start in javascript?
The idea is to have the number's ubication, "n-", at the start of the line, but I don't know how to do that (yet). Can someone help me? https://code.sololearn.com/WlQ7mvXqMPpk/?ref=app
1 Resposta
0
Instead of using document.write in every switch, you could use a variable to build your string, so you can add text to the end or to the start of the variable depending on your needs.
That way you could replace switch(ub) with this:
if (ub > 1 && ub<=10) {
stringToPrint = ub + '-' + stringToPrint;
}