在Javascript中,如果您有If ... Else If ... Else If ... Else情况,计算机会继续检查下一个项目,前提是是否触发了其他项目。例如。如果第一个“If”语句为真并且代码执行,它是否仍然尝试检查“Else If”或“Else”的条件?If and Else If Execution
1
A
回答
5
没有它不会检查,如果由于您使用否则,如果条件为真 如果
相反,如果你要是如果要是那么所有的if语句将被执行
7
假设你有一个代码段使用
if(a)
func1()
else if(b)
func2()
else if(c)
func3()
else
func4();
//next statement
如果a
为真func1()
将被调用,并且在它返回后,控件将转到下一个语句。
因此,如果b
为真,那么最初将调用func2()
,然后在返回后,控件将转到下一个语句。
func4()
将被调用如果a
,b
,c
所有这些都是错误的。 func4()
返回控制之后去下一个语句。
相关问题
- 1. If/Else and typeof problems
- 2. if and else in Aurelia.js
- 3. if-else vs if-else-if-else
- 4. if/if else/else
- 5. if [true] and [true] then .... else .... batch
- 6. if else condition with and operator
- 7. If and Else help;蟒蛇
- 8. Javascript“if and else”语句
- 9. If/else with button and input
- 10. if else else if sql
- 11. Javascript if if else else
- 12. “if else”in php when“if”and“else”have same action
- 13. if else if else语句(JS)
- 14. getElementById.innerHTML if if else
- 15. if else if else in angular js
- 16. 嵌套if-else vs if-else?
- 17. jQuery if if else else filter
- 18. sys.stdin.readline()if if else(Python)
- 19. if/else或double if?
- 20. 的if else与AND,OR在Excel
- 21. if elif else construct and full DRY conform
- 22. SAS if-else if not working
- 23. if,else if和else声明? java
- 24. 如何提高我的“if and else if”VBA?代码
- 25. T-SQL IF-ELSE
- 26. Python(if,else,elif)
- 27. javascript - 如何控制if/else if/else
- 28. 调试器行为在if,else if,else
- 29. if if else else does not work php
- 30. for循环if if else else批号
不,它不 – Phil 2012-03-21 06:29:53