Skip to content

Commit 298e008

Browse files
committed
refactor: added two way to test the function to convert str to pounds
1 parent 6e1b61c commit 298e008

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ function toPounds(str){
6161
const decimals = (onlyNumbers/100).toFixed(2);
6262

6363
return ${decimals}`;
64+
};
65+
66+
67+
68+
// =============================== 1st way to test ========================
69+
70+
const examples = ["79p", "hfhbgjk1p", "150p", "£2.50", "11000"];
71+
for (const example of examples) {
72+
console.log(toPounds(example));
6473
}
6574

66-
console.log(toPounds("hfhbgjk1p"));
75+
76+
// =============================== 2nd way to test ========================
77+
78+
// const examples2 = ["79p", "hfhbgjk1p", "150p", "£2.50", "12000"];
79+
// for (const example of examples2) {
80+
// console.log(`Original: ${example} -> Formatted: ${toPounds(example)}`);
81+
// };

0 commit comments

Comments
 (0)