Skip to content

Commit 5293699

Browse files
author
Enice-Codes
committed
modified my answers from second sprint
1 parent bfe65da commit 5293699

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

Sprint-2/2-mandatory-debug/0.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
function multiply(a, b) {
7-
concole.lpg( a* b);
7+
concole.log( a* b);
88

99
}
1010

@@ -18,5 +18,6 @@ console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1818
function multiply (a,b){
1919
if (a===10 && b===32){
2020
let result =a * b ;
21+
return result;
2122
}
2223
}

Sprint-2/3-mandatory-implement/2-cases.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
// This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase
1717

1818
function touppersneakers (input){
19-
return input.trim().replace(/\s+/g, "_").touppercase();
19+
return input.toUpperCase();
2020
}
21-
console.log(touppersneakers("hello there"));//Hello There
22-
console.log(touppersneakers("lord of the rings")); // lord of the rings
23-
console.log(touppersneakers("good morning")); // GOOD MORNING
21+
console.log(touppersneakers("hello there").toUpperCase());//Hello There
22+
console.log(touppersneakers("lord of the rings").toUpperCase()); // LORD_OF_THE_RINGS
23+
console.log(touppersneakers("good morning").toUpperCase()); // GOOD MORNING

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77

88

99

10-
function toSnakeCase(str) {
11-
const pecestringwithouttrailingp = pencestring.substring(0,pencestring.length -1);
12-
const padded penceNumberstring = pencestringWithoutTrailingP.padstart(3,"0");
13-
const pounds = paddedpenceNumberString.substring(0, paddedpencenumberstring.length-2);
14-
const pencr= paddedpencenumberstring.substring(paddedpencenumberstring.length -2)
15-
.padEnd(2,"0");
16-
return £${pounds}.${pence}`;
10+
function toPounds(penceString) {
11+
const penceStringWithoutTrailingP = penceString.substring(0, penceString.length - 1);
12+
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
13+
const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2);
14+
const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2)
15+
.padEnd(2, "0");
16+
return `£${pounds}.${pence}`;
1717
}
1818
// test the function with different inputs
19-
consloe.log(topounds("399p"), // £3.99
20-
4console.log(toPounds("9p")); // £0.09
19+
console.log(toPounds("399p")); // £3.99
20+
console.log(toPounds("9p")); // £0.09
2121
console.log(toPounds("99p")); // £0.99
2222
console.log(toPounds("1234p")); // £12.34
2323

0 commit comments

Comments
 (0)