Skip to content

Commit 1bbe9ed

Browse files
committed
updated PR template
1 parent 246a80c commit 1bbe9ed

File tree

8 files changed

+4438
-9
lines changed

8 files changed

+4438
-9
lines changed

Sprint-1/1-key-exercises/3-paths.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ console.log(`The base part of ${filePath} is ${base}`);
1717
// Create a variable to store the dir part of the filePath variable
1818
// Create a variable to store the ext part of the variable
1919

20-
const dir = ;
21-
const ext = ;
20+
const dir = filePath.slice(0, lastSlashIndex);
21+
const lastDotIndex = base.lastIndexOf(".");
22+
const ext = base.slice(lastDotIndex + 1);
23+
24+
console.log("Directory path:", dir);
25+
console.log("File path:", base);
26+
console.log("File extension:", ext);
2227

2328
// https://www.google.com/search?q=slice+mdn

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ console.log(`The percentage change is ${percentageChange}`);
1212
// Read the code and then answer the questions below
1313

1414
// a) How many function calls are there in this file? Write down all the lines where a function call is made
15-
// There are 5 function calls. Number(), carPrice.replaceAll(),priceAfterOneYear.replaceAll(), console.log(),percentageChange(),
15+
// There are 5 function calls. Number(), carPrice.replaceAll(),priceAfterOneYear.replaceAll(), console.log(),Number().
1616

1717
// 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?
1818
//The error is at line 5. It is a Syntax error. A comma is expected in between the two strings.By adding , in between the stings.

Sprint-1/3-mandatory-interpret/2-time-format.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ console.log(result);
1919

2020
// c) Using documentation, explain what the expression movieLength % 60 represents
2121
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
22-
//Remainder assignment. Which means when 8784 seconds is divided by 60 it gives 24.
22+
//Remainder assignment. Which means when 8784 seconds is divided by 60 it gives 146 with a remainder of 24.
2323

2424
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
2525
//movieLength - remainingSeconds removes the leftover seconds that don’t make up a full minute.

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ console.log(`£${pounds}.${pence}`);
2525

2626
// To begin, we can start with
2727
// 1. const penceString = "399p": initialises a string variable with the value "399p"
28+
//3-6.substring(start, end) extracts characters from index start up to (but not including) end. Here we use penceString.length - 1 so we take every character except the final one — removing the trailing "p".
29+
//8. padStart(targetLength, padString) ensures the string has at least targetLength characters by adding padString at the start if needed. We padStart(3, "0") to guarantee the numeric string is at least 3 characters long so the later slicing (split into pounds and pence) works consistently for very small amounts (e.g. "5p" → "005").
30+
//9.This extracts everything before the last two characters of paddedPenceNumberString. Those final two characters represent pence, so everything before them is the pounds portion. Using .substring(0, length - 2) is a simple way to split the numeric string into pounds and pence.
31+
//14. .substring(paddedPenceNumberString.length - 2) with a single argument returns the substring from that start index to the end — i.e., the last two characters — which are the pence.
32+
//.padEnd(2, "0") ensures the pence string has exactly 2 characters, padding on the right if somehow it’s shorter (defensive programming). In normal flows the substring already returns 2 characters because we earlier padStart(3, "0").
33+
//18. console.log(`£${pounds}.${pence}`) prints the formatted price: the pound sign, the pounds portion, a dot, then the two-digit pence string.

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ In the Chrome console,
1111
invoke the function `alert` with an input string of `"Hello world!"`;
1212

1313
What effect does calling the `alert` function have?
14-
15-
Now try invoking the function `prompt` with a string input of `"What is your name?"` - store the return value of your call to `prompt` in an variable called `myName`.
14+
//A message that says Hello World pops up on the top of the page.
1615

1716
What effect does calling the `prompt` function have?
17+
//A message saying what is your name with a box to write your name in pops up.
18+
1819
What is the return value of `prompt`?
20+
//A message saying my name is with a box to write your name in pops up on the top of the page.

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ In this activity, we'll explore some additional concepts that you'll encounter i
55
Open the Chrome devtools Console, type in `console.log` and then hit enter
66

77
What output do you get?
8+
// The 'console.log' as it is appears but with a single qoute.
9+
810

911
Now enter just `console` in the Console, what output do you get back?
12+
// 'console' is the output.
1013

1114
Try also entering `typeof console`
15+
//'typeof console' is the output backticks are changed to single quotes.
1216

1317
Answer the following questions:
1418

1519
What does `console` store?
20+
// console stores a collection of functions to output.
1621
What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean?
22+
// `.` means that read what is inside as a string not as a function. So instead of expecting an output from `console.log` we expect it to be executed as it is as a string.

0 commit comments

Comments
 (0)