Created
August 7, 2014 03:57
-
-
Save cycold/2136116c81af615e3f65 to your computer and use it in GitHub Desktop.
For 循环中的if中return语句
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for( var i=0; i<10; i++ ){ | |
if( i == 5 ){ | |
console.log(i); | |
return i; //这里return后,后面的代码就不会执行了,即使是在if语句中 | |
} | |
console.log(i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment