Created
November 24, 2016 00:59
-
-
Save anemochore/95af73e09ee2f2c66b9c979d662774b0 to your computer and use it in GitHub Desktop.
만약 ㄹ혜가 자바스크립트로 코딩한다면
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
//제목: 만약 ㄹ혜가 자바스크립트로 코딩한다면 | |
//알고리즘 문제: 팩토리얼(계승) | |
//작성자: ephemeral_truth@ausi.com | |
//아이디어: [만약 헤밍웨이가 자바스크립트로 코딩한다면] | |
function factorial(n) { | |
//비선실세에게 전화해서 계승 문제에 n을 넣으면 얼마인지 물어본다. | |
return 비선실세핫라인("계승", n); | |
} | |
function 비선실세핫라인(problem, n) { | |
//실세는 우주의 기운을 반환한다. | |
var 우주의기운; | |
if(problem == "계승") { | |
//계승 문제이므로 우주의 기운을 곱해나가면 될 듯? | |
우주의기운 = 1; | |
for(var i = 1; i <= n; i++) { | |
우주의기운 *= i; | |
} | |
} | |
else if(problem.indexOf("돈") > -1) { | |
//돈과 관련된 문제라면 비선실세가 원하는 것은 하나다. | |
우주의기운 = n + Infinity; | |
} | |
else if(problem.indexOf("인사") > -1) { | |
//인사 관련 문제라면... | |
return 친구들[Math.floor(Math.random()*친구들.length)]; | |
} | |
else if(problem == "연설문") { | |
//이제 연설문 수정은 대충대충 합시다. | |
우주의기운 = "내가 이러려고 대통령을 했나 자괴감 들어..."; | |
} | |
else { | |
우주의기운 = "잘 모르겠길라임"; | |
} | |
//하지만 문제가 뭐든 답은 이미 정해져 있는 듯하다. | |
return "Yoora Chung"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment