在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,else if and end Lua
- 2. if and else in Aurelia.js
- 3. If/Else and typeof problems
- 4. If-else and self question
- 5. Javascript IF/Else and performance
- 6. if and else not working
- 7. If else and switch statment
- 8. if-else vs if-else-if-else
- 9. if/if else/else
- 10. if else condition with and operator
- 11. Python 3 and-or vs if-else
- 12. if [true] and [true] then .... else .... batch
- 13. Javascript“if and else”语句
- 14. If and Else help;蟒蛇
- 15. if and else does not work
- 16. If/else with button and input
- 17. if else else if sql
- 18. Javascript if if else else
- 19. “if else”in php when“if”and“else”have same action
- 20. 如何在PROLOG中执行序列“If,Else If and Else”?
- 21. if/else if/else menu issue c
- 22. if else if else语句(JS)
- 23. getElementById.innerHTML if if else
- 24. if if else
- 25. Javascript if if else always return to 2 else if
- 26. if else if else in angular js
- 27. jQuery if if else else filter
- 28. 嵌套if-else vs if-else?
- 29. jQuery/Javascript if if contains else else
- 30. If Else If Else sort XSLT1.0
不,它不 – Phil 2012-03-21 06:29:53