We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd6a95d commit a1ae7a3Copy full SHA for a1ae7a3
Sprint-2/3-mandatory-implement/3-to-pounds.js
@@ -5,9 +5,10 @@
5
6
// You should call this function a number of times to check it works for different inputs
7
8
-function toPounds(kilograms) {
9
- return +(kilograms * 2.20462).toFixed(1);
+function toPounds(penceString) {
+ const pence = Number(penceString.slice(0, -1));
10
+ return `£${(pence / 100).toFixed(2)}`;
11
}
-console.log(toPounds(1)); // should return 2.2
12
-console.log(toPounds(5)); // should return 11
13
-console.log(toPounds(10)); // should return 22
+console.log(toPounds("100p")); // should return £1.00
+console.log(toPounds("399p")); // should return £3.99
14
+console.log(toPounds("10p")); // should return £0.10
0 commit comments