Advertisement
ErolKZ

Untitled

Sep 15th, 2021
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1.  
  2. function solve(n) {
  3.  
  4.  
  5. let months = [ [ "January", "February", "March", "April", "May", "June", "July",
  6. "August", "September", "October", "November", "December" ] ];
  7.  
  8.  
  9. const output = months.map(par => par[n - 1]);
  10.  
  11.  
  12. if (String(output[0])) {
  13.  
  14. return output[0];
  15.  
  16. } else {
  17.  
  18. return 'Error!';
  19.  
  20. }
  21.  
  22.  
  23. }
  24.  
  25.  
  26. console.log(solve('44'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement