There was an error while loading. Please reload this page.
1 parent d90778b commit 2c96140Copy full SHA for 2c96140
1 file changed
Sprint-3/3-mandatory-implement/3-to-pounds.js
@@ -5,9 +5,11 @@
5
6
// You should call this function a number of times to check it works for different inputs
7
function toPounds(pence) {
8
- return pence / 100;
+ const penceNumber = Number(pence.replace("p", ""));
9
+ const pounds = penceNumber / 100;
10
+ return `£${pounds.toFixed(2)}`;
11
}
12
-console.log(toPounds(100));
-console.log(toPounds(250));
13
-console.log(toPounds(500));
+console.log(toPounds("399p"));
14
+console.log(toPounds("5p"));
15
+console.log(toPounds("2500p"));
0 commit comments