whitestarrr

Untitled

Oct 28th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. function main(input) {
  2. "use strict";
  3. let number = input[0].substring(input[0].split("").length - 1);
  4. let lastDigit = parseInt(number) % 10;
  5.  
  6. let result;
  7. if (lastDigit == 0) {
  8. result = "zero";
  9. }
  10. else if (lastDigit == 1){
  11. result = "one";
  12. }
  13. else if (lastDigit == 2){
  14. result = "two";
  15. }
  16. else if (lastDigit == 3){
  17. result = "three";
  18. }
  19. else if (lastDigit == 4){
  20. result = "four";
  21. }
  22. else if (lastDigit == 5){
  23. result = "five";
  24. }
  25. else if (lastDigit == 6){
  26. result = "six";
  27. }
  28. else if (lastDigit == 7){
  29. result = "seven";
  30. }
  31. else if (lastDigit == 8){
  32. result = "eight";
  33. }
  34. else if (lastDigit == 9){
  35. result = "nine";
  36. }
  37. console.log(result);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment