Mihail_Atnsv

slotMachine

Apr 5th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function slotMachine(args) {
  2.  let symbolN = String(args[0])
  3.  let NumberN1 = Number(args[1])
  4.  let symbolM = String(args[2])
  5.  let NumberM1 = Number(args[3])
  6.  let symbolK = String(args[4])
  7.  let NumberK1 = Number(args[5])
  8.  
  9. //  console.log(String.fromCharCode(97))
  10. // console.log('a'.charCodeAt())
  11.  
  12. let resultN = String.fromCharCode(symbolN.charCodeAt() + NumberN1);
  13. let resultM = String.fromCharCode(symbolM.charCodeAt() + NumberM1);
  14. let resultK = String.fromCharCode(symbolK.charCodeAt() + NumberK1);
  15. let endResult = resultN + resultM + resultK
  16.  
  17.     if(resultN == '@' && resultM == '@' && resultK == '@') {
  18.         console.log(endResult)
  19.         console.log('!!! YOU LOSE EVERYTHING !!!')
  20.     } else if(resultN == '7' && resultM == '7' && resultK == '7') {
  21.         console.log(endResult)
  22.         console.log('*** JACKPOT ***')
  23.     } else {
  24.         console.log(endResult)
  25.     }
  26. }
  27.  
  28. slotMachine(["a", "2", "a", "3", "a", "4"])
  29. // slotMachine(["?","1","=","3", "9", "7"])
  30. // slotMachine(["/", "8", "5", "2", "5", "2"])
Add Comment
Please, Sign In to add comment