Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
9fe8e3b
Explain "count = count + 1"
joanne342 May 11, 2026
2c99f4a
Get first initials and concatenate them
joanne342 May 11, 2026
c811a4e
Update 3-paths.js
joanne342 May 12, 2026
b53d2f2
Update 4-random.js
joanne342 May 12, 2026
f3f64c3
Update 0.js
joanne342 May 13, 2026
6f33c1f
Update 1.js
joanne342 May 13, 2026
442479d
Update 2.js
joanne342 May 13, 2026
df5bb9a
Update 3.js
joanne342 May 13, 2026
3e0991e
Change variable name to not start with a number
joanne342 May 13, 2026
05646f8
answered questions
joanne342 May 13, 2026
16f45c7
answer questions
joanne342 May 13, 2026
1015d39
answered the questions
joanne342 May 13, 2026
ecb2ea6
fixed code and explained error
joanne342 May 14, 2026
463b942
explained error and fixed code
joanne342 May 14, 2026
1155363
corrected code and explained with comments
joanne342 May 14, 2026
5f70bec
fixed code and explained with comments
joanne342 May 14, 2026
2e416ef
calculate BMI
joanne342 May 15, 2026
c3ecc09
Update 2-cases.js
joanne342 May 15, 2026
a70a9d8
fixed code and explained error in comments
joanne342 May 15, 2026
19bfed1
fixed code and wrote explanation in comments
joanne342 May 15, 2026
6cb40cc
put pounds program into a function
joanne342 May 15, 2026
3d272d6
Update time-format.js
joanne342 May 15, 2026
f834c59
wrote tests
joanne342 May 19, 2026
b50059c
Update 3-get-card-value.test.js
joanne342 May 29, 2026
9c80660
Update 3-get-card-value.js
joanne342 May 29, 2026
07a945c
Update 1-get-angle-type.js
joanne342 May 30, 2026
152cad6
Update 2-is-proper-fraction.js
joanne342 May 30, 2026
2ed2285
Update 2-is-proper-fraction.test.js
joanne342 May 30, 2026
5893e7b
Update count.js
joanne342 Jun 6, 2026
b464d8f
Update count.test.js
joanne342 Jun 6, 2026
38fd408
Update count.js
joanne342 Jun 6, 2026
802acdf
Update get-ordinal-number.js
joanne342 Jun 13, 2026
bc421fe
Update get-ordinal-number.test.js
joanne342 Jun 13, 2026
13d1460
Update get-ordinal-number.js
joanne342 Jun 13, 2026
99731ea
Update get-ordinal-number.js
joanne342 Jun 13, 2026
5565323
Update get-ordinal-number.js
joanne342 Jun 13, 2026
d2470e2
Update get-ordinal-number.test.js
joanne342 Jun 13, 2026
7d82706
Update repeat-str.js
joanne342 Jun 13, 2026
9994930
Update repeat-str.js
joanne342 Jun 13, 2026
c8b67c4
Update repeat-str.js
joanne342 Jun 13, 2026
5ee586b
Update repeat-str.test.js
joanne342 Jun 13, 2026
ee47e29
Update exercise-1.js
joanne342 Jun 13, 2026
4fed182
Update exercise-2.js
joanne342 Jun 13, 2026
9738b16
Delete Sprint-2 directory
joanne342 Jun 13, 2026
524720a
Delete Sprint-3 directory
joanne342 Jun 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Sprint-1/1-key-exercises/1-count.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ let count = 0;

count = count + 1;

// The single equals means assignment.
// It is saying the value of count is now the previous value of count plus one.
//If it was == or ===, it would be testing equality and asking if count (0) is equal to 0+1 which would give false.

// Line 1 is a variable declaration, creating the count variable with an initial value of 0
// Describe what line 3 is doing, in particular focus on what = is doing
4 changes: 3 additions & 1 deletion Sprint-1/1-key-exercises/2-initials.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ let lastName = "Johnson";
// Declare a variable called initials that stores the first character of each string.
// This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution.

let initials = ``;
let initials = firstName[0] + middleName[0] + lastName[0];

console.log(initials)

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

9 changes: 6 additions & 3 deletions Sprint-1/1-key-exercises/3-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ console.log(`The base part of ${filePath} is ${base}`);
// Create a variable to store the dir part of the filePath variable
// Create a variable to store the ext part of the variable

const dir = ;
const ext = ;
const dir = filePath.slice(0,lastSlashIndex);
console.log(`The dir part of ${filePath} is ${dir}`);

// https://www.google.com/search?q=slice+mdn
const ext = base.split(".").slice(1)
console.log(`The ext part of ${filePath} is ${ext}`);

// https://www.google.com/search?q=slice+mdn
7 changes: 7 additions & 0 deletions Sprint-1/1-key-exercises/4-random.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
// Try breaking down the expression and using documentation to explain what it means
// It will help to think about the order in which expressions are evaluated
// Try logging the value of num and running the program several times to build an idea of what the program is doing

// get the maximum minus minimum
// add 1 to count the edges and avoid the fencepost error
// this generates the correct span
// add the minimum on so it starts at the right number
// multiply it by a random decimal between 0 and 1
// round it down to the next whole number down
4 changes: 2 additions & 2 deletions Sprint-1/2-mandatory-errors/0.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This is just an instruction for the first activity - but it is just for human consumption
We don't want the computer to run these 2 lines - how can we solve this problem?
// This is just an instruction for the first activity - but it is just for human consumption
// We don't want the computer to run these 2 lines - how can we solve this problem?
2 changes: 1 addition & 1 deletion Sprint-1/2-mandatory-errors/1.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// trying to create an age variable and then reassign the value by 1

const age = 33;
let age = 33;
age = age + 1;
2 changes: 1 addition & 1 deletion Sprint-1/2-mandatory-errors/2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Currently trying to print the string "I was born in Bolton" but it isn't working...
// what's the error ?

console.log(`I was born in ${cityOfBirth}`);
const cityOfBirth = "Bolton";
console.log(`I was born in ${cityOfBirth}`);
5 changes: 3 additions & 2 deletions Sprint-1/2-mandatory-errors/3.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const cardNumber = 4533787178994213;
const last4Digits = cardNumber.slice(-4);
const cardNumber = "4533787178994213";
const last4Digits = cardNumber.slice(cardNumber.length-4,cardNumber.length);
console.log(last4Digits)

// The last4Digits variable should store the last 4 digits of cardNumber
// However, the code isn't working
Expand Down
4 changes: 2 additions & 2 deletions Sprint-1/2-mandatory-errors/4.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const 12HourClockTime = "20:53";
const 24hourClockTime = "08:53";
const TwelveHourClockTime = "20:53";
const TwentyFourHourClockTime = "08:53";
7 changes: 6 additions & 1 deletion Sprint-1/3-mandatory-interpret/1-percentage-change.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ let carPrice = "10,000";
let priceAfterOneYear = "8,543";

carPrice = Number(carPrice.replaceAll(",", ""));
priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ""));
priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",",""));

const priceDifference = carPrice - priceAfterOneYear;
const percentageChange = (priceDifference / carPrice) * 100;
Expand All @@ -12,11 +12,16 @@ console.log(`The percentage change is ${percentageChange}`);
// Read the code and then answer the questions below

// a) How many function calls are there in this file? Write down all the lines where a function call is made
// Five: two on line 4, two on line 5 and one on line 10.

// 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?
// Comma was missing on line 5. I've added it, the second comma here: .replaceAll(",","")

// c) Identify all the lines that are variable reassignment statements
// lines 4 and 5

// d) Identify all the lines that are variable declarations
// lines 1, 2, 7 and 8

// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
// It takes the comma out of the numbers so it can be converted to a number one can do calculations with. The commas are just to make it more readable for humans.
6 changes: 6 additions & 0 deletions Sprint-1/3-mandatory-interpret/2-time-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ console.log(result);
// For the piece of code above, read the code and then answer the following questions

// a) How many variable declarations are there in this program?
// 6

// b) How many function calls are there?
// 1

// c) Using documentation, explain what the expression movieLength % 60 represents
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
// It's modulo. In this case, it gives the remainder of seconds after one gets the number of minutes by dividing by 60.

// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
// It avoids using floor division, so it's more comprehensible to beginners, by subtracting the remaining seconds from the film length. The it divides by 60 to get hours.

// e) What do you think the variable result represents? Can you think of a better name for this variable?
// It shows the time in hours, minutes and seconds. You could call it timeHoursMinsSecs

// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
// It wouldn't work well if the user typed the answer as a string. The input is unlikely to be negative or run over a day or have a user finnicky enough to state seconds with a decimal. It might look nicer if it was padded with zeros.
11 changes: 11 additions & 0 deletions Sprint-1/3-mandatory-interpret/3-to-pounds.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
const penceString = "399p";

// remove last character
const penceStringWithoutTrailingP = penceString.substring(
0,
penceString.length - 1
);

// pad to the length of three
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");

// remove the last two characters
const pounds = paddedPenceNumberString.substring(
0,
paddedPenceNumberString.length - 2
);

// get last two characters and pad to two if needed
const pence = paddedPenceNumberString
.substring(paddedPenceNumberString.length - 2)
.padEnd(2, "0");
Expand All @@ -25,3 +30,9 @@ console.log(`£${pounds}.${pence}`);

// To begin, we can start with
// 1. const penceString = "399p": initialises a string variable with the value "399p"

// penceStringWithoutTrailingP: remove last character
// paddedPenceNumberString: pad to the length of three
// pounds: remove the last two characters of paddedPenceNumberString
// pence: get last two characters and pad to two if needed
// log to the console in the format £[pounds].[pence]
13 changes: 0 additions & 13 deletions Sprint-2/1-key-errors/0.js

This file was deleted.

20 changes: 0 additions & 20 deletions Sprint-2/1-key-errors/1.js

This file was deleted.

20 changes: 0 additions & 20 deletions Sprint-2/1-key-errors/2.js

This file was deleted.

14 changes: 0 additions & 14 deletions Sprint-2/2-mandatory-debug/0.js

This file was deleted.

13 changes: 0 additions & 13 deletions Sprint-2/2-mandatory-debug/1.js

This file was deleted.

24 changes: 0 additions & 24 deletions Sprint-2/2-mandatory-debug/2.js

This file was deleted.

19 changes: 0 additions & 19 deletions Sprint-2/3-mandatory-implement/1-bmi.js

This file was deleted.

16 changes: 0 additions & 16 deletions Sprint-2/3-mandatory-implement/2-cases.js

This file was deleted.

6 changes: 0 additions & 6 deletions Sprint-2/3-mandatory-implement/3-to-pounds.js

This file was deleted.

38 changes: 0 additions & 38 deletions Sprint-2/4-mandatory-interpret/time-format.js

This file was deleted.

25 changes: 0 additions & 25 deletions Sprint-2/5-stretch-extend/format-time.js

This file was deleted.

Loading
Loading