Javascript Statement Quiz

Javascript examples for Statement:Quiz

Description

Click the following links for the tutorial for Statement and Quiz.

  1. Use the break statement to stop the loop at 5.
  2. Use the continue statement to skip the number 5 in the loop.
  3. Use the continue statement to skip the numbers 5 AND 7 in the loop.
  4. Use the continue statement to not output the array's element "CSS".
  5. Use the if statement to output some text if 5 is greater than 2.
  6. Use if statement to check if 10 is greater than 5.
  7. Change the string value using if statement
  8. Use if statement to check string value


  9. Use if/else statement to check int value
  10. Add curly braces to if/else statement
  11. Run for loop from 0 to 9
  12. Make the loop start counting from 5 instead of 0
  13. Make the loop start counting from 5. Count up to (including) 50, and count only every fifth number.
  14. Make the loop start counting downwards from 10 and stop at 1. The output should be 10 9 8 7 6 5 4 3 2 1 with line breaks.
  15. for loop: Set the counter variable (i) to 0, Run the loop as long as i is less than the length of the food array.
  16. Create a for loop that output the numbers 1 3 5 7 9 with line breaks between each number.


  17. Use switch statement on string value
  18. Use switch statement with default case.
  19. Add a break statement to end each case.
  20. Make while loop start counting from 5 instead of 0
  21. Make while loop start counting from 5. Count up to (including) 50 and count only every fifth number.
  22. Make while loop start counting downwards from 10 and stop at 1. The output should be 10 9 8 7 6 5 4 3 2 1 with line breaks.
  23. Use do/while loop to output 0 1 2 3 4.