- 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?
4 Réponses
+ 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
+ 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 :)
+ 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 :)
+ 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 :)