There was an error while loading. Please reload this page.
1 parent 46db88c commit 0cf04adCopy full SHA for 0cf04ad
1 file changed
Sprint-3/3-mandatory-implement/3-to-pounds.js
@@ -4,3 +4,13 @@
4
// You will need to declare a function called toPounds with an appropriately named parameter.
5
6
// You should call this function a number of times to check it works for different inputs
7
+function toPounds(penceString) {
8
+ const pence = Number(penceString.replace("p", ""));
9
+ return `£${(pence / 100).toFixed(2)}`;
10
+}
11
+
12
+console.log(toPounds("399p"));
13
+console.log(toPounds("5p"));
14
+console.log(toPounds("50p"));
15
+console.log(toPounds("1250p"));
16
+console.log(toPounds("0p"));
0 commit comments