Skip to content

Instantly share code, notes, and snippets.

@moriiimo
Last active December 16, 2015 01:09
Show Gist options
  • Save moriiimo/5352694 to your computer and use it in GitHub Desktop.
Save moriiimo/5352694 to your computer and use it in GitHub Desktop.
100をfor, whileを使わないでconsole.logで出力する。: level2 - for文、while文を使ってはいけません
$(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