Skip to content

Commit 45d6ec8

Browse files
committed
improved my work regarding to the feedback
1 parent 9a911dd commit 45d6ec8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Sprint-2/3-mandatory-implement/3-to-pounds.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
// You should call this function a number of times to check it works for different inputs
77

8-
function toPounds(pence) {
9-
return "£" + (pence / 100).toFixed(2);
8+
function toPounds(penceString) {
9+
const penceNumber = Number(penceString.slice(0, -1));
10+
return "£" + (penceNumber / 100).toFixed(2);
1011
}
11-
console.log(toPounds(399));
12-
console.log(toPounds(250));
13-
console.log(toPounds(100));
12+
13+
console.log(toPounds("399p"));
14+
console.log(toPounds("250p"));
15+
console.log(toPounds("100p"));

0 commit comments

Comments
 (0)