Skip to content

Commit 0d90b74

Browse files
fix: keep changes within Sprint-1 only
1 parent 3af2171 commit 0d90b74

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

Sprint-1/2-mandatory-errors/3.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const cardNumber = "4533787178994213";
2-
const last4Digits = cardNumber.slice(-4);
3-
console.log(last4Digits)
2+
const last4Digits = cardNumber.slice(-4);
3+
console.log(last4Digits);
44

55
// The last4Digits variable should store the last 4 digits of cardNumber
66
// However, the code isn't working

Sprint-1/3-mandatory-interpret/3-to-pounds.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,26 @@ console.log(`£${pounds}.${pence}`);
2222

2323
// To begin, we can start with
2424
// 1. const penceString = "399p": initialises a string variable with the value "399p"
25+
2526
// 2. const penceStringWithoutTrailingP = penceString.substring(0, penceString.length - 1); Here we use subString() to extracts everything except the last character.
27+
2628
// 3.const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
29+
2730
// padStart(3, "0") ensures the string has at least 3 characters.
2831
// If the string is shorter than 3, zeros ("0") are added at the beginning.
2932
// If the string is already 3 or more characters, nothing changes.
3033
// padStart() ensures the code works for all pence values, including 1-digit and 2-digit numbers.
3134
// Without padStart(), the logic would only work correctly for numbers that already have 3 or more digits.
35+
3236
// 4.const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2);
37+
3338
// This line used extract the pound value 3 from the padded pence string 399 .
39+
3440
// 5.const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0");
41+
3542
//This line extracts the last two digits from paddedPenceNumberString by starting at length - 2 and going to the end.
3643
// Then padEnd(2, "0") ensures the pence value always has two digits.
44+
3745
// 6.console.log(`£${pounds}.${pence}`);
46+
3847
// Here we use console.log() to print our output and merge the pound value and pence value and add pound symbol using template literals.

Sprint-1/4-stretch-explore/chrome.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ Now try invoking the function `prompt` with a string input of `"What is your nam
1818
What effect does calling the `prompt` function have?
1919
It Will open the prompt and asking for the input.
2020
What is the return value of `prompt`?
21-
prompt() returns a string, or empty string, or null (if Cancel is pressed).
21+
prompt() returns a string, or empty string, or null (if Cancel is pressed).
2222

0 commit comments

Comments
 (0)