|
| 05 Feb 2016 02:49 PM |
hi guys
im using codeacademy to learn javascript I got stuck reply to me and ill show u the question |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 02:50 PM |
| I think this question would be better answered on StackOverflow |
|
|
| Report Abuse |
|
|
Dralian
|
  |
| Joined: 21 Mar 2013 |
| Total Posts: 7624 |
|
|
| 05 Feb 2016 02:51 PM |
whats the code?
also, dont use codeacademy in my opinion, learn the basics from that, but use treehouse or something |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 02:58 PM |
Controlling the for loop
We can now control where the for loop starts and ends. What about controlling what happens in between?
The examples we've looked at have used i = i + 1. This has meant we have incremented (increased) the variable i by 1 each time.
Rules to learn
a. A more efficient way to code to increment up by 1 is to write i++. b. We decrement down by 1 by writing i--. c. We can increment up by any value by writing i += x, where x is how much we want to increment up by. e.g., i += 3 counts up by 3s. d. We can decrement down by any value by writing i -= x. (See the Hint for more.) e. Be very careful with your syntax—if you write a loop that can't properly end, it's called an infinite loop. It will crash your browser!
Instructions 01. This code counts every number from 0 to 35. 02. Make it start counting from 5. Please! 03. Stop the counting when it prints out 50. 04. Only count every fifth number. So we want to increment i by 5.
?
Hint
Get live, fast support from Codecademy Advisors when you get stuck. Learn more. The changes to be made:
a. Replace 0 with the value you want the for loop to start. b. Replace 36 with where you want the for loop to end. c. Currently, the for loop increments up by 1. You want it to increment up by 5!
Note: x += y is the same as x = x + y. And x -= y is the same as x = x - y.
|
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 02:58 PM |
| Click the Q&A forum button.. |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Feb 2016 03:04 PM |
| it should help better than we do |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Feb 2016 12:41 AM |
| I get bc on 30% and im on 28% |
|
|
| Report Abuse |
|
|
adam1717
|
  |
| Joined: 07 May 2011 |
| Total Posts: 960 |
|
|
| 06 Feb 2016 12:43 AM |
Uhm, are you trying to cheat?
You're only cheating yourself. |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2016 12:46 AM |
| I Did it when I read it carefully! |
|
|
| Report Abuse |
|
|