Skip to content

Commit 4488e38

Browse files
committed
Final updates before need review, and use format document
1 parent 95b4184 commit 4488e38

File tree

3 files changed

+45
-41
lines changed

3 files changed

+45
-41
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
// else
2929
// result+=s1[i];
3030
// }
31-
// let UPPER_SNAKE_CASE=result.toUpperCase();
32-
// return UPPER_SNAKE_CASE;
31+
// let upperSnakeCase=result.toUpperCase();
32+
// return upperSnakeCase;
3333
// }
3434
// console.log(ConvertToUpperSnakeCase("Ahmad Hmedan"));
3535

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55

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

8-
9-
function toPound(penceString)
10-
{
11-
const penceWithoutP=penceString.substring(0,penceString.length-1);
12-
const paddedPence=penceWithoutP.padStart(3,"0");
13-
const pound=paddedPence.substring(0,paddedPence.length-2);
14-
const Pence=paddedPence.substring(paddedPence.length-2);
15-
return ${pound}.${Pence}`
8+
function toPound(penceString) {
9+
const penceWithoutP = penceString.substring(0, penceString.length - 1);
10+
const paddedPence = penceWithoutP.padStart(3, "0");
11+
const pound = paddedPence.substring(0, paddedPence.length - 2);
12+
const Pence = paddedPence.substring(paddedPence.length - 2);
13+
return ${pound}.${Pence}`;
1614
}
1715
console.log(toPound("100p"));

Sprint-2/5-stretch-extend/format-time.js

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
// This is the latest solution to the problem from the prep.
22
// Make sure to do the prep before you do the coursework
3-
// Your task is to write tests for as many different groups of input data or edge cases as you can, and fix any bugs you find.
3+
//
4+
// function formatAs12HourClock(time) {
5+
// const hours = Number(time.slice(0, 2));
6+
// if (hours > 12) {
7+
// return `${hours - 12}:00 pm`;
8+
// }
9+
// return `${time} am`;
10+
// }
411

5-
function formatAs12HourClock(time) {
6-
const hours = Number(time.slice(0, 2));
7-
if (hours > 12) {
8-
return `${hours - 12}:00 pm`;
9-
}
10-
return `${time} am`;
11-
}
12-
13-
const currentOutput = formatAs12HourClock("08:00");
14-
const targetOutput = "08:00 am";
15-
console.assert(
16-
currentOutput === targetOutput,
17-
`current output: ${currentOutput}, target output: ${targetOutput}`
18-
);
12+
// const currentOutput = formatAs12HourClock("08:00");
13+
// const targetOutput = "08:00 am";
14+
// console.assert(
15+
// currentOutput === targetOutput,
16+
// `current output: ${currentOutput}, target output: ${targetOutput}`
17+
// );
1918

20-
const currentOutput2 = formatAs12HourClock("23:00");
21-
const targetOutput2 = "11:00 pm";
22-
console.assert(
23-
currentOutput2 === targetOutput2,
24-
`current output: ${currentOutput2}, target output: ${targetOutput2}`
25-
);
26-
const currentOutput3=formatAs12HourClock("00:00");
27-
const targetOutput3="12:00 am";
28-
console.assert(currentOutput3===targetOutput3,
29-
`current output: ${currentOutput3}, target output: ${targetOutput3}`
30-
)
31-
const currentOutput4=formatAs12HourClock("12:00");
32-
const targetOutput4="12:00 pm";
33-
console.assert(currentOutput4===targetOutput4,
34-
`current output: ${currentOutput4}, target output: ${targetOutput4}`
35-
)
19+
// const currentOutput2 = formatAs12HourClock("23:00");
20+
// const targetOutput2 = "11:00 pm";
21+
// console.assert(
22+
// currentOutput2 === targetOutput2,
23+
// `current output: ${currentOutput2}, target output: ${targetOutput2}`
24+
// );
25+
// const currentOutput3=formatAs12HourClock("00:00");
26+
// const targetOutput3="12:00 am";
27+
// console.assert(currentOutput3===targetOutput3,
28+
// `current output: ${currentOutput3}, target output: ${targetOutput3}`
29+
// )
30+
// const currentOutput4=formatAs12HourClock("12:00");
31+
// const targetOutput4="12:00 pm";
32+
// console.assert(currentOutput4===targetOutput4,
33+
// `current output: ${currentOutput4}, target output: ${targetOutput4}`
34+
// )
3635

3736

3837
// This is my version
@@ -84,6 +83,13 @@ console.assert(
8483

8584
currentTime = TimeAs12hours("00:00");
8685
targetTime = "12:00 am";
86+
console.assert(
87+
currentTime === targetTime,
88+
`current time:${currentTime}, Target Time:${targetTime}`
89+
);
90+
91+
currentTime=TimeAs12hours("12:00");
92+
targetTime="12:00 pm";
8793
console.assert(
8894
currentTime === targetTime,
8995
`current time:${currentTime}, Target Time:${targetTime}`

0 commit comments

Comments
 (0)