Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

JavaScript/Reserved words/case

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

JavaScript byte catch Reserved words 0 The case keyword The case keyword is used in the switch statement that is an alternative for complex if … else if … else statements. Examples The code var array = [2, 3, 5, 7, 10, 11]; for (var i = 0; i < array.length; i++) { switch (array[i]) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: alert(array[i] + " is a number with one digit."); break; default: alert(array[i] + " is a number with several digits."); break; } } returns the following: 2 is a number with one digit. 3 is a number with one digit. 5 is a number with one digit. 7 is a number with one digit. 10 is a number with several digit. 11 is a number with several digit. See also break default switch JavaScript byte catch Reserved words 0