728x90 반응형 SMALL programming375 chapter 4) while ### Basic `while` Loop with User Confirmation - Initializes a counter variable `i` to `0`. - Enters a `while` loop that continues as long as the user clicks the "OK" button in a confirmation dialog box prompted by `confirm('continue?')`. - Inside the loop, an `alert` displays the current value of `i` followed by the word "repeat", then increments `i` by `1`. - This loop demonstrates how to perfo.. 2024. 12. 1. chapter 4) continue ### Script Breakdown - **Variable Initialization**: `let output = 0` initializes a variable named `output` to store the cumulative sum of even numbers. - **For Loop**: `for (let i = 1; i 2024. 11. 30. chapter 4) break ### How the Script Works: - **Initialization**: `for (let i =0; true; i++)` starts a loop with `i` initialized at `0`. The condition in the middle of the `for` loop declaration is simply `true`, which means the loop will continue indefinitely until explicitly broken out of. - **Alert Dialog**: Inside the loop, `alert(i + 'repeat')` displays an alert dialog to the user that shows the current valu.. 2024. 11. 29. chapter 3) Using nested conditionals ### Script Explanation Upon entering a grade, the script assigns it to the `score` variable after converting the input to a number. The grade is then evaluated through a series of conditional statements to categorize it. These categories range from "god" for a perfect score to various playful categories for lower scores, down to "revolution of current" for scores not fitting any other category. .. 2024. 11. 28. 이전 1 ··· 15 16 17 18 19 20 21 ··· 94 다음 728x90 반응형 LIST