Advertisement
Guest User

Untitled

a guest
Sep 28th, 2020
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Converter(arg1, arg2, arg3) {
  2.     let first = Number(arg1);
  3.     let second = String(arg2);
  4.     let third = String(arg3);
  5.     let conversion = second + third;
  6.     if (conversion = 'mm' + 'm') {
  7.         let result = first / 1000;
  8.         console.log (result.toFixed(3));
  9.     } else if (conversion === 'mm' + 'cm') {
  10.         let result = first * 10;
  11.         console.log (result.toFixed(3));
  12.     } else if (conversion === 'cm' + 'm') {
  13.         let result = first / 10;
  14.         console.log (result.toFixed(3));
  15.     } else if (conversion === 'cm' + 'mm') {
  16.         let result = first * 10;
  17.         console.log (result.toFixed(3));
  18.     } else if (conversion === 'm' + 'mm') {
  19.         let result = first * 1000;
  20.         console.log(result.toFixed(3));
  21.     } else if (conversion === 'm' + 'cm') {
  22.         let result = first * 100;
  23.         console.log(result.toFixed(3))
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement