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

20th Jun 2019, 9:06 AM
M. Elle
M. Elle - avatar
1 Answer
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; }
31st Jul 2019, 1:28 PM
Mario GarcĂ­a
Mario GarcĂ­a - avatar