Skip to content

Commit cf13333

Browse files
committed
changed the function now the output is a number
1 parent d1dfef3 commit cf13333

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Sprint-2/3-mandatory-implement/3-to-pounds.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55

66
// You should call this function a number of times to check it works for different inputs
77

8+
// I thought adding "lbs" need to be inside a string .
9+
// i converted the string back to number
10+
811
function toPounds(kg) {
912
const pounds = kg * 2.20462;
10-
return `${pounds.toFixed(2)} lbs`; // returns a string
13+
return Number(pounds.toFixed(2));
1114
}
15+
console.log(`${toPounds(5)} lbs`);
16+
1217

13-
// Test cases
14-
console.log(toPounds(1)); //the output "2.20 lbs"
15-
console.log(toPounds(5)); //the output is "11.02 lbs"
16-
console.log(toPounds(10)); //the output is "22.05 lbs"
18+
// more Test cases
19+
console.log(`${toPounds(1)} lbs`); // 2.20 lbs
20+
console.log(`${toPounds(5)} lbs`); // 11.02 lbs
21+
console.log(`${toPounds(10)} lbs`); // 22.05 lbs

0 commit comments

Comments
 (0)