Created
June 24, 2022 15:15
-
-
Save pbrumblay/a6574c69fd888fe4aac1aa986ffb1477 to your computer and use it in GitHub Desktop.
Using Vietnamese numerology, is your number lucky?
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
const myArgs = process.argv.slice(2); | |
let computedNum = 99999; | |
let numString = myArgs[0]; | |
while(computedNum > 9) { | |
let sum = 0; | |
for (var i = 0; i < numString.length; i++) { | |
sum += parseInt(numString.charAt(i)); | |
} | |
computedNum = sum; | |
numString = computedNum + ''; | |
} | |
switch(computedNum) { | |
case 0: | |
case 1: | |
case 2: | |
case 3: | |
console.log('Not lucky. Not unlucky.'); | |
break; | |
case 4: | |
console.log('OMG you are screwed. Run away. Run far away.'); | |
break; | |
case 5: | |
console.log('Not lucky. Not unlucky.'); | |
break; | |
case 6: | |
console.log('I get a different answer every time I ask my wife if this is lucky.'); | |
break; | |
case 7: | |
console.log('Not lucky. Not unlucky.'); | |
break; | |
case 8: | |
console.log('This is a really lucky number.'); | |
break; | |
case 9: | |
console.log('This is the luckiest most lucky super awesome number ever.'); | |
break; | |
} |
Author
pbrumblay
commented
Jun 24, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment