Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function metricConverter(input) {
- let num = Number(input.shift());
- let type1 = input.shift();
- let type2 = input.shift();
- if (type1 == "mm") {
- num /= 1000;
- } else if (type1 == "cm"){
- num /= 100;
- }
- if (type2 == "mm"){
- num *= 1000;
- } else if (type2 == "cm"){
- num *= 100;
- }
- console.log(num.toFixed(3));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement