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 9a911dd commit 45d6ec8Copy full SHA for 45d6ec8
Sprint-2/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
8
-function toPounds(pence) {
9
- return "£" + (pence / 100).toFixed(2);
+function toPounds(penceString) {
+ const penceNumber = Number(penceString.slice(0, -1));
10
+ return "£" + (penceNumber / 100).toFixed(2);
11
}
-console.log(toPounds(399));
12
-console.log(toPounds(250));
13
-console.log(toPounds(100));
+
+console.log(toPounds("399p"));
14
+console.log(toPounds("250p"));
15
+console.log(toPounds("100p"));
0 commit comments