The switch statement of JavaScript
2016-09-04 14:17
302 查看
The struct of switch statement is as follows:
The function evaluate expression and get value from each case value or expression.When the result of expression matches one of them,Statements following this value executed.
**Attention!
The result of expression uses === to match value!
The result of expression uses === to match value!
The result of expression uses === to match value!
Important things need to repeat three times. :-)
For more information,see ECMA-262, 3rd edition.
switch (expression) { case value1: //Statements executed when the result of expression matches value1 [break;] case value2: //Statements executed when the result of expression matches value2 [break;] ... case valueN: //Statements executed when the result of expression matches valueN [break;] default: //Statements executed when none of the values match the value of the expression [break;] }
The function evaluate expression and get value from each case value or expression.When the result of expression matches one of them,Statements following this value executed.
**Attention!
The result of expression uses === to match value!
The result of expression uses === to match value!
The result of expression uses === to match value!
Important things need to repeat three times. :-)
For more information,see ECMA-262, 3rd edition.
相关文章推荐
- JavaScript学习笔记-- The switch Statement
- [JavaScript]让footer总是停留在页面的底部(footer all the way at the bottom of the page)
- Statement of the Honorable Mary Sheila Gall
- 【原】用使用JavaScript展开/折叠TreeView中所有节点(Expand and Collapse All Nodes of asp.net Treeview on the client with javascript)
- About the difference of href='javascript:void(0)' and href=‘#’
- 错误: Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries.
- How does the certain version of a certain brower support the JavaScript Standard?(come from Javascript:The definitive guide, 4th
- Functions part1(Chapter 4 of JavaScript: The Good Parts)
- javascript: change the content of table
- Prototype and Scriptaculous: Taking the Pain out of JavaScript
- Grammar(Chapter 2 of JavaScript: The Good Parts)
- The future of OO Javascript
- About the Statement Of Work(SOW)
- MEGE的需要注意的小地方【THE TIP OF MERGE STATEMENT】
- secrets of the javascript Ninja( with(){} 的用法)(javascript忍者的秘密)
- Use Flex and JavaScript to get the full path of a local File
- Overview of the Prototype Javascript Library(转贴)
- Chapter6 The Basics of JavaScript
- SQL Error:An aggregate may not appear in the set list of an UPDATE statement.
- Objects(Chapter 3 of JavaScript: The Good Parts)