+ 3

for (i=1; i<=5; i++) { document.write(i + "<br />"); } why should used for + symbol inside the parentheses...lemma explain

JavaScript

8th Jun 2017, 3:19 PM
Mőhåň Ķűmæř
Mőhåň Ķűmæř - avatar
3 Respostas
+ 3
i and <br> are two separate things, so of you write them two like this: i<br> It won't understand what you mean by it and it won't recognise the i in i<br> as a number either, so you should write them apart with a + sign. That means it'll write i with <br> right after it
8th Jun 2017, 3:24 PM
Maart
Maart - avatar
+ 3
this is one of the reasons I use ES6 template string, backticks (``). The example above could just be: document.write(`${i}</br>`)
13th Jun 2017, 11:22 AM
Benneth Yankey
Benneth Yankey - avatar
+ 1
Concept of operator overloading. In some languages + is used for string concatenation.
8th Jun 2017, 3:52 PM
Da' BO$
Da' BO$ - avatar