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 c52e087 commit 0de1e19Copy full SHA for 0de1e19
Sprint-2/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 formaPenceToPounds(penceString){
8
+ const penceStringWithoutTrailingP = penceString.substring(0, penceString.length -1);
9
+ const pounds = paddedPenceNumberString.slice(0, -2);
10
+ const pence = paddedPenceNumberString.slice(-2);
11
+ return `£${pounds}.${pence}`;
12
+}
13
+
14
+console.log(formatPenceToPounds("9p"));
15
+console.log(formatPenceToPounds("39p"));
16
+console.log(formatPenceToPounds("399"));
0 commit comments