Created
November 2, 2014 23:25
-
-
Save f3r/a601a2169579106d7caf to your computer and use it in GitHub Desktop.
5-min Quiz - Javascript return
This file contains 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
/// | |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return | |
// | |
// $ brew update && install node | |
// $ node return.js | |
// | |
var print = function(t){ console.log(t) }; | |
var counter = function() { | |
for (var c=1;; c++) { | |
print(c); | |
if (c === 3) { return } | |
print(c); | |
} | |
print(c); | |
} | |
counter(); | |
// What's the output of this program? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment