Skip to content

Commit 8c04eec

Browse files
format documets
1 parent e765236 commit 8c04eec

2 files changed

Lines changed: 12 additions & 13 deletions

File tree

‎Sprint-2/3-mandatory-interpret/1-percentage-change.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,19 @@ console.log(`The percentage change is ${percentageChange}`);
1616
replaceAll() - Line 4 and Line 5
1717
console.log() - Line 10*/
1818

19-
2019
// b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem?
21-
/* line 5 , There is a comma missing between "," and ""*/
20+
/* line 5 , There is a comma missing between "," and ""*/
2221

2322
// c) Identify all the lines that are variable reassignment statements
24-
/* Line 4 :carPrice = Number(carPrice.replaceAll(",", ""));
23+
/* Line 4 :carPrice = Number(carPrice.replaceAll(",", ""));
2524
Line5 : priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));
2625
carPrice and priceAfterOneYear were already declared on Line 1 and 2 using let */
2726

2827
// d) Identify all the lines that are variable declarations
29-
/* Line 1 : let carPrice = "10,000";
28+
/* Line 1 : let carPrice = "10,000";
3029
Line 2 : let priceAfterOneYear = "8,543";
3130
Line 7 : const priceDifference = carPrice - priceAfterOneYear;
3231
Line 8 : const percentageChange = (priceDifference / carPrice) * 100;*/
3332

3433
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
35-
/*replaceAll remove all the commas from the string and Number convert string to the number*/
34+
/*replaceAll remove all the commas from the string and Number convert string to the number*/

‎Sprint-2/3-mandatory-interpret/3-to-pounds.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ const penceString = "399p";
22

33
const penceStringWithoutTrailingP = penceString.substring(
44
0,
5-
penceString.length - 1
5+
penceString.length - 1,
66
);
77

88
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
99
const pounds = paddedPenceNumberString.substring(
1010
0,
11-
paddedPenceNumberString.length - 2
11+
paddedPenceNumberString.length - 2,
1212
);
1313

1414
const pence = paddedPenceNumberString
@@ -27,17 +27,17 @@ console.log(`£${pounds}.${pence}`);
2727
// 1. const penceString = "399p": initialises a string variable with the value "399p"
2828

2929
// 2. const penceStringWithoutTrailingP = penceString.substring(0,penceString.length - 1);
30-
// create a new variable and put the string without p
30+
// create a new variable and put the string without p
3131

3232
// 3. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
33-
// padStart() adds characters to the beginning of a string to make it 3 characters long.
34-
// because we need to convert it to pound and pence
33+
// padStart() adds characters to the beginning of a string to make it 3 characters long.
34+
// because we need to convert it to pound and pence
3535

3636
// 4. const pounds = paddedPenceNumberString.substring(0,paddedPenceNumberString.length - 2);
3737
// We remove the last 2 characters and store the remaining part of the string as pounds.
3838

3939
// 5. const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0");
40-
// Gets the last two characters as pence.”
40+
// Gets the last two characters as pence.”
4141

42-
// 6. console.log(`£${pounds}.${pence}`);
43-
//. Finally combine pound and pence
42+
// 6. console.log(`£${pounds}.${pence}`);
43+
//. Finally combine pound and pence

0 commit comments

Comments
 (0)