Last active
December 16, 2015 01:09
-
-
Save moriiimo/5352694 to your computer and use it in GitHub Desktop.
100をfor, whileを使わないでconsole.logで出力する。: level2 - for文、while文を使ってはいけません
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
$(function () { | |
// 出力用配列 | |
var tmpAry = new Array(100); | |
var tmpAryString = tmpAry.toString(); | |
var aryString = tmpAryString.replace(/\,/g, "a@"); | |
var baseAry = aryString.split("@"); | |
// level1, level2: 再帰呼び出し | |
var recursive = function() { | |
function inner(a, b) { | |
if (a <= b) { | |
console.log(a); | |
return inner(a+1, b); | |
} | |
return false; | |
} | |
inner(1, 100); | |
}; | |
recursive(); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment