Advertisement
vladovip

JS - Digits with Words

Dec 31st, 2021
1,003
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve ( strNumber) {
  2.    
  3.     let receivedInput = strNumber;
  4.  
  5.     switch (strNumber) {
  6.         case "zero": console.log(0); break;
  7.         case "one": console.log(1); break;
  8.         case "two": console.log(2); break;
  9.         case "three": console.log(3); break;
  10.         case "four": console.log(4); break;
  11.         case "five": console.log(5); break;
  12.         case "six": console.log(6); break;
  13.         case "seven": console.log(7); break;
  14.         case "eight": console.log(8); break;
  15.         case "nine": console.log(9); break;
  16.         case "ten": console.log(10); break;
  17.         default: console.log("the input is not recognized"); break;
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement