[英]Nested if statement in if else
if (document.URL.indexOf("google") != -1) {
alert('at google');
}
else if (document.URL.indexOf("yahoo") != -1) {
if(a === true){
alert("true");
if(b === false)
alert("false");
}
I am having a hard time understanding nesting in Yahoo's code. 我很难理解Yahoo代码中的嵌套。 Is this possible?
这可能吗?
Yes, this is entirely possible. 是的,这完全有可能。
If document.URL.indexOf("google") != -1
, it will alert 'at google' 如果
document.URL.indexOf("google") != -1
,则会提醒“在Google”
If document.URL.indexOf("yahoo") != -1
and a === true
, then it will alert 'true' 如果
document.URL.indexOf("yahoo") != -1
和 a === true
,则它将警告“ true”
If document.URL.indexOf("yahoo") != -1
but b === false
, then it will alert 'false' 如果
document.URL.indexOf("yahoo") != -1
但 b === false
,则它将警告“ false”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.