- 1

I was looking at JS and the "for loop" stated text inside the statements? Code was ran, but there was no text? Why have text?

https://code.sololearn.com/WMky7crTe0U8/?ref=app

17th Nov 2017, 3:24 AM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
4 ответов
+ 3
If you want to print the text go like this: for (i=1, text="????"; i<=5; i++) { //text = i; document.write(text + "<br />"); } Your current code does document.write(i ...), and that's why it prints number (i) instead of text. Hth, cmiiw
17th Nov 2017, 4:17 AM
Ipang
+ 2
@Achmad Hussain, You can simply do percentage = salary * 0.1; for getting the 10% of the salary, also remember to use floating point type for both salary and the percentage, I will leave the code up to you, hope that helps :)
17th Nov 2017, 6:13 AM
Ipang
+ 2
@Achmad Hussain, I have given you the example above, you need to write the code by yourself, I do not write the code for you, I give hint on how it could be done, the implementation is yours to perform :)
17th Nov 2017, 6:31 AM
Ipang
+ 1
I see you have completed Java course here, I guess it shouldn't be so hard, look, just try to make the code in Code Playground, and then create your own thread + the code linked with the question, then you may get help from the community. Just give it a try :)
17th Nov 2017, 6:44 AM
Ipang