Skip to content

Commit 47508e8

Browse files
committed
Reset Sprint-2 to match main
1 parent 388daad commit 47508e8

14 files changed

Lines changed: 12 additions & 92 deletions

File tree

‎Sprint-2/1-key-exercises/1-count.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@ count = count + 1;
44

55
// Line 1 is a variable declaration, creating the count variable with an initial value of 0
66
// Describe what line 3 is doing, in particular focus on what = is doing
7-
8-
// count is being increased each time the code runs by +1. = is basically just reassigning the value each time.

‎Sprint-2/1-key-exercises/2-initials.js‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ const lastName = "Johnson";
55
// Declare a variable called initials that stores the first character of each string.
66
// This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution.
77

8-
const firstChar = firstName.charAt(0);
9-
const secondChar = middleName.charAt(0);
10-
const thirdChar = lastName.charAt(0);
11-
12-
13-
const initials = `${firstChar}${secondChar}${thirdChar}`;
14-
console.log(initials)
8+
const initials = ``;
159

1610
// https://www.google.com/search?q=get+first+character+of+string+mdn

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@ 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-
21-
22-
const dir = filePath.slice(0, lastSlashIndex);
23-
const ext = filePath.slice(filePath.lastIndexOf("."), filePath.length);
24-
25-
console.log(dir)
26-
console.log(ext)
20+
const dir = ;
21+
const ext = ;
2722

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

‎Sprint-2/1-key-exercises/4-random.js‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,3 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
77
// Try breaking down the expression and using documentation to explain what it means
88
// It will help to think about the order in which expressions are evaluated
99
// Try logging the value of num and running the program several times to build an idea of what the program is doing
10-
11-
// Math.floor() - rounds down to nearest integer
12-
// Math.random() - gives a random number
13-
// (max - min + 1) - 100
14-
// simple bodmas bro
15-
16-
// math.random = 2
17-
// num = 201

‎Sprint-2/2-mandatory-errors/0.js‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
// This is just an instruction for the first activity - but it is just for human consumption
2-
// We don't want the computer to run these 2 lines - how can we solve this problem?
3-
4-
// Comment out lines with "//"
1+
This is just an instruction for the first activity - but it is just for human consumption
2+
We don't want the computer to run these 2 lines - how can we solve this problem?

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// trying to create an age variable and then reassign the value by 1
22

3-
let age = 33;
3+
const age = 33;
44
age = age + 1;
5-
// changed const to let

‎Sprint-2/2-mandatory-errors/2.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// Currently trying to print the string "I was born in Bolton" but it isn't working...
22
// what's the error ?
33

4-
const cityOfBirth = "Bolton";
54
console.log(`I was born in ${cityOfBirth}`);
6-
7-
// You must first assign the var before u try to print it
5+
const cityOfBirth = "Bolton";

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const cardNumber = "4533787178994213";
1+
const cardNumber = 4533787178994213;
22
const last4Digits = cardNumber.slice(-4);
33

44
// The last4Digits variable should store the last 4 digits of cardNumber
@@ -7,5 +7,3 @@ const last4Digits = cardNumber.slice(-4);
77
// Then run the code and see what error it gives.
88
// Consider: Why does it give this error? Is this what I predicted? If not, what's different?
99
// Then try updating the expression last4Digits is assigned to, in order to get the correct value
10-
console.log(last4Digits)
11-
// cardNumber was stored as a number, which does not work with .splice().

‎Sprint-2/2-mandatory-errors/4.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
const twelveHourClockTime = "8:53pm";
2-
const miliataryhourClockTime = "20:53";
3-
// variables cannot start with a number.
1+
const 12HourClockTime = "8:53pm";
2+
const 24hourClockTime = "20:53";
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
let carPrice = "10,000";
22
let priceAfterOneYear = "8,543";
33

4-
carPrice = Number(carPrice.replaceAll(",",""));
5-
priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",",""));
4+
carPrice = Number(carPrice.replaceAll(",", ""));
5+
priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ""));
66

77
const priceDifference = carPrice - priceAfterOneYear;
88
const percentageChange = (priceDifference / carPrice) * 100;
@@ -12,16 +12,11 @@ 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-
// Number() line 4,5. .replaceAll() line 4,5. console.log() line 10.
1615

1716
// 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?
18-
// line 5: put a comma between the find and replace
1917

2018
// c) Identify all the lines that are variable reassignment statements
21-
// line 4, 5.
2219

2320
// d) Identify all the lines that are variable declarations
24-
// line 1,2,7,8.
2521

2622
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
27-
// convert str to number type and find and replace commas with nothing so that the number is read correctly.

0 commit comments

Comments
 (0)