Fill in the blank to start the count at 99. |
for (________ i <200; i++) { |
let i = 99; |
leti=99; |
Fill in the blank to decrement the counter by 1 on each iteration. |
for (let i = 0; i > -10; ___) { |
i-- |
i-- |
Code the first line of a for loop that counts up from 0 as long as j hasn't reached 9. Increment by 1. Use the count limiter that you learned in the last chapter. |
|
for (let j = 0; j < 9; j++) { |
for\(letj=0;j<9;j\+\+\){ |
Code the first line of a for loop that counts down from -10 as long as k hasn't reached -20. Use the count limiter that you learned in the last chapter. |
|
for (let k = -10; k > -20; k--) { |
for\(letk=-10;k>-20;k--\){ |
- Code the first line of a for loop. Use any counter name other than i.
- Start the counter at 6.
- Count up as long as the counter hasn't reached 24. Use the count limiter that you learned in the last chapter.
- Increment by 1.
|
|
for (let count = 6; count < 24; count++) { |
for\(let([a-z_$][a-zA-Z0-9_$]*)=6;\1<24;\1\+\+\){ |
- Code the first line of a for loop. Make up a counter name other than i.
- Start the counter at 100.
- Count down as long as the counter hasn't reached 0. Use the count limiter that you learned in the last chapter.
- Decrement by 1 on each iteration.
|
|
for (let j = 100; j > 0; j--) { |
for\(let([a-z_$][a-zA-Z0-9_$]*)=100;\1>0;\1--\){ |
- The counter has been initialized before the for statement begins, so it can be skipped in the first line of the statement. Code the first line. Make up the counter name.
- The loop iterates as long as the counter hasn't reached 9. Use the count limiter that you learned in the last chapter.
- Increment by 1.
|
|
for (; i < 9; i++) { |
for\(;([a-z_$][a-zA-Z0-9_$]*)<9;\1\+\+\){ |
- In this for loop the first and second expressions inside the parentheses are omitted.
- The counter has been initialized before the for statement begins.
- The loop limiter is handled in an if statement in the body.
- Code the first line of the for statement. Make up the counter name. Decrement by 1.
|
|
for (;;i--) { |
for\(;;i--\){ |
- Code a for loop that counts down from 20 to 0.
- Decrement by 2.
- When the count reaches 0, display the counter in an alert.
- Click the Result button (or, after revising, don't click, just wait).
- Wait a moment.
- If you've coded correctly, your alert will display 0.
- Dismiss the alert by clicking OK.
- For help with this code, see Chapter 27 in the book.
|
|
|
|
- I've coded an array. Leave my code intact.
- Code a for loop that checks each element to see if it's "rose".
- Use the loop limiter that you learned in this chapter.
- When "rose" is found, display the element's index in an alert. Don't forget the break statement
- Click the Result button (or, after revising, don't click, just wait).
- Wait a moment.
- If you've coded correctly, the integer 2 will display in an alert.
- Dismiss the alert by clicking OK.
- For help with this code, see Chapter 27 in the book.
| |
|
|