Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ced2c8b
Created animal website and index.html
chefmatthaus-hub Sep 12, 2026
dfe221f
Part 1 - Creating the repository
chefmatthaus-hub Sep 12, 2026
20df3e3
Added colour options for shirts
chefmatthaus-hub Sep 12, 2026
5817f0b
Changed Footer Name
chefmatthaus-hub Sep 12, 2026
857487a
Added shirt size options
chefmatthaus-hub Sep 12, 2026
66bd2de
Added Customer Details Field
chefmatthaus-hub Sep 12, 2026
8bc3b93
changed shirt color label "for"
chefmatthaus-hub Sep 12, 2026
adf2ba2
Added a submit button
chefmatthaus-hub Sep 13, 2026
1979160
added a <p> for the button
chefmatthaus-hub Sep 13, 2026
b6c78a5
Neatened my line of code added a few <p> and <div>
chefmatthaus-hub Sep 13, 2026
cf2d074
Added my first .css
chefmatthaus-hub Sep 13, 2026
3c9fa22
Added .css to button
chefmatthaus-hub Sep 13, 2026
04a9d41
Added .css to select
chefmatthaus-hub Sep 13, 2026
daa9c1f
Removed shirt size label
chefmatthaus-hub Sep 13, 2026
c1fc3d4
added additional hover .css to select
chefmatthaus-hub Sep 13, 2026
4e8e014
added .css to input
chefmatthaus-hub Sep 13, 2026
0300b47
corrected email address field type to from "text" to "email"
chefmatthaus-hub Sep 13, 2026
1543377
added select option to option field
chefmatthaus-hub Sep 13, 2026
bb8c532
added .css to field set
chefmatthaus-hub Sep 13, 2026
f873d15
added "aria-label" to select field
chefmatthaus-hub Sep 13, 2026
eb8a31f
Delete animal-website/index.html
chefmatthaus-hub Sep 13, 2026
15d2158
Delete git-collaboration/animal-website/index.html
chefmatthaus-hub Sep 13, 2026
f8c3552
added a style sheet file
chefmatthaus-hub Sep 15, 2026
abf9de6
made some required attributes
chefmatthaus-hub Sep 15, 2026
cdb761b
Sprint-3/
chefmatthaus-hub Sep 28, 2026
47f65d6
feat: complete sprint-3
chefmatthaus-hub Sep 28, 2026
f839af8
Restore Form-Controls files and remove accidental files
chefmatthaus-hub Sep 28, 2026
f2aa74a
Remove unrelated Form-Controls changes
chefmatthaus-hub Sep 28, 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
20 changes: 15 additions & 5 deletions Sprint-3/1-key-errors/0.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
// Predict and explain first...
// =============> write your prediction here
// It will make the first letter in the string input capitalised.

// call the function capitalise with a string input
// interpret the error message and figure out why an error is occurring
// "SyntaxError: Identifier 'str' has already been declared"

// capitalise("matthaus enjoys foood.")

// function capitalise(str) {
// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
// return str;
// }

// The error is thrown by declaring the 'str' variable again in the function with 'let' which causes it throw the SyntaxError, as it is already been declared.

capitalise("matthaus enjoys food")

function capitalise(str) {
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
return str;
return `${str[0].toUpperCase()}${str.slice(1)}`;
}

// =============> write your explanation here
// =============> write your new code here
console.log(capitalise("Matthaus enjoys food"));
26 changes: 18 additions & 8 deletions Sprint-3/1-key-errors/1.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
// Predict and explain first...
// It will give you a percentage of 50% using the function by multiplying the 'decimalNumber' by 100 for the 'percentage' variables.

// Why will an error occur when this program runs?
// =============> write your prediction here
// It will be a syntaxError because the 'decimalNumber' is already called in the function parameter.

// Try playing computer with the example to work out what is going on

// function convertToPercentage(decimalNumber) {
// const decimalNumber = 0.5;
// const percentage = `${decimalNumber * 100}%`;

// return percentage;
// }

// console.log(decimalNumber);

// decimalNumber in console.log isn't a defined number in the functions parameter now so it will return back as NaN "Not a Number", by adding '0.05' to the console.log it now has a number to calculate the percentage to

// Finally, correct the code to fix the problem


function convertToPercentage(decimalNumber) {
const decimalNumber = 0.5;
const percentage = `${decimalNumber * 100}%`;

return percentage;
}

console.log(decimalNumber);

// =============> write your explanation here
}

// Finally, correct the code to fix the problem
// =============> write your new code here
console.log(convertToPercentage(0.5))
20 changes: 13 additions & 7 deletions Sprint-3/1-key-errors/2.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@

// Predict and explain first BEFORE you run any code...
// The function won't return be able to return the value to the caller, due to the expression not being assigned.

// this function should square any number but instead we're going to get an error

// =============> write your prediction of the error here
// The expression will return as unexpected number in the console log

function square(3) {
return num * num;
}
// function square(3) {
// return num * num;
// }

// =============> write the error message here
// SyntaxError: Unexpected number

// =============> explain this error message here
// The parameter set by the function isn't attached to the num value of the return, so the return doesn't have a value to work with

// Finally, correct the code to fix the problem

// =============> write your new code here
function square(num) {
return num * num;
}

console.log(square(3));



18 changes: 11 additions & 7 deletions Sprint-3/2-mandatory-debug/0.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
// Predict and explain first...

// =============> write your prediction here
// There is no return in the function, the wrong use of console.log is being used, therefore the function isn't being closed and only is the console.log being logged twice, causing the function's parameters to be defined by the return.

function multiply(a, b) {
console.log(a * b);
}
// function multiply(a, b) {
// console.log(a * b);
// }

console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
// console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);

// =============> write your explanation here
// The instead of console.log being used in the functions expression, there should be a return.

// Finally, correct the code to fix the problem
// =============> write your new code here
function multiply(a, b) {
return a * b;
}

console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
18 changes: 11 additions & 7 deletions Sprint-3/2-mandatory-debug/1.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
// Predict and explain first...
// =============> write your prediction here
// By using the semi-colon after the return, this is closing off the function and leaving the parameters as undefined, causing the console.log state that the parameters are undefined.

// function sum(a, b) {
// return;
// a + b;
// }

// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

// by using the semi-colon after the return, and having the parameters put into a separate line, the return can't define the parameters of the function.
// Finally, correct the code to fix the problem
function sum(a, b) {
return;
a + b;
return a + b;
}

console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

// =============> write your explanation here
// Finally, correct the code to fix the problem
// =============> write your new code here
30 changes: 21 additions & 9 deletions Sprint-3/2-mandatory-debug/2.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
// Predict and explain first...

// Predict the output of the following code:
// =============> Write your prediction here
// Because the num variable is defined globally and the function doesn't set the parameter using num, which isn't being called and the consol.log ignores it and refers back to the global variable being set on line 6

// const num = 103;

// function getLastDigit() {
// return num.toString().slice(-1);
// }

// console.log(`The last digit of 42 is ${getLastDigit(42)}`);
// console.log(`The last digit of 105 is ${getLastDigit(105)}`);
// console.log(`The last digit of 806 is ${getLastDigit(806)}`);

// Now run the code and compare the output to your prediction
// The last digit of 42 is 3
// The last digit of 105 is 3
// The last digit of 806 is 3

// Explain why the output is the way it is
// There is no parameter set in the function, so the function when called is ignored and the console.log only outputs the const variable of num

// Finally, correct the code to fix the problem
const num = 103;

function getLastDigit() {
function getLastDigit(num) {
return num.toString().slice(-1);
}

console.log(`The last digit of 42 is ${getLastDigit(42)}`);
console.log(`The last digit of 105 is ${getLastDigit(105)}`);
console.log(`The last digit of 806 is ${getLastDigit(806)}`);

// Now run the code and compare the output to your prediction
// =============> write the output here
// Explain why the output is the way it is
// =============> write your explanation here
// Finally, correct the code to fix the problem
// =============> write your new code here

// This program should tell the user the last digit of each number.
// Explain why getLastDigit is not working properly - correct the problem
5 changes: 4 additions & 1 deletion Sprint-3/3-mandatory-implement/1-bmi.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
// It should return a string of their Body Mass Index to 1 decimal place

function calculateBMI(weight, height) {
// return the BMI of someone based off their weight and height
let bmi = weight / (height * height);
return bmi.toFixed(1);
}

console.log(calculateBMI(72, 1.82));
8 changes: 8 additions & 0 deletions Sprint-3/3-mandatory-implement/2-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@
// You will need to come up with an appropriate name for the function
// Use the MDN string documentation to help you find a solution
// This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase

const string = "hello there"

function cases(inputStr) {
return inputStr.toUpperCase().replace(/ /g, "_");
}

console.log(cases(string));
25 changes: 25 additions & 0 deletions Sprint-3/3-mandatory-implement/3-to-pounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,28 @@
// You will need to declare a function called toPounds with an appropriately named parameter.

// You should call this function a number of times to check it works for different inputs

function toPounds(penceString) {
const penceStringWithoutTrailingP = penceString.substring(
0,
penceString.length - 1
);

const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");

const pounds = paddedPenceNumberString.substring(
0,
paddedPenceNumberString.length - 2
);

const pence = paddedPenceNumberString
.substring(paddedPenceNumberString.length - 2)
.padEnd(2, "0");

return `£${pounds}.${pence}`;
}

console.log(toPounds("399p"));
console.log(toPounds("458p"));
console.log(toPounds("756p"));
console.log(toPounds("5425p"));
12 changes: 7 additions & 5 deletions Sprint-3/4-mandatory-interpret/time-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,26 @@ function formatTimeDisplay(seconds) {
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
}

console.log(formatTimeDisplay(61));

// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
// to help you answer these questions

// Questions

// a) When formatTimeDisplay is called how many times will pad be called?
// =============> write your answer here
// 3 times (once for hours, once for minutes and once for seconds)

// Call formatTimeDisplay with an input of 61, now answer the following:

// b) What is the value assigned to num when pad is called for the first time?
// =============> write your answer here
// With an input of 61 seconds, totalHours evaluates to 0. Therefore, num is assigned 0 on the first call

// c) What is the return value of pad when it is called for the first time?
// =============> write your answer here
// The return value is "00". Since the input is 0, its string length is less than 2, so the while loop runs it twice to prepend two zeros ("00")

// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
// =============> write your answer here
// The value assigned is 1. This is for remainingSeconds, which receives the remainder of 61 % 60, resulting in 1.

// e) What is the return value of pad when it is called for the last time in this program? Explain your answer
// =============> write your answer here
// The return value is "01". Because the input is 1, its string length is less than 2, so the while loop runs once to prepend a single zero("01")
36 changes: 33 additions & 3 deletions Sprint-3/5-stretch-extend/format-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@
// Your task is to write tests for as many different groups of input data or edge cases as you can, and fix any bugs you find.

function formatAs12HourClock(time) {
const hours = Number(time.slice(0, 2));
const hoursStr = time.slice(0, 2);
const hours = Number(hoursStr);
const minutes = time.slice(3, 5);

if (hours === 0) {
return `12:${minutes} am`;
}

if (hours > 12) {
return `${hours - 12}:00 pm`;
return `${String(hours - 12).padStart(2, '0')}:${minutes} pm`;
}
return `${time} am`;

if (hours === 12) {
return `12:${minutes} pm`;
}

return `${hoursStr}:${minutes} am`;
}

const currentOutput = formatAs12HourClock("08:00");
Expand All @@ -23,3 +35,21 @@ console.assert(
currentOutput2 === targetOutput2,
`current output: ${currentOutput2}, target output: ${targetOutput2}`
);

const currentOutput3 = formatAs12HourClock("12:30");
const targetOutput3 = "12:30 pm";
console.assert(
currentOutput3 === targetOutput3,
`current output: ${currentOutput3}, target output: ${targetOutput3}`
);

const currentOutput4 = formatAs12HourClock("00:15");
const targetOutput4 = "12:15 am";
console.assert(
currentOutput4 === targetOutput4,
`current output: ${currentOutput4}, target output: ${targetOutput4}`
);

console.log(formatAs12HourClock("13:15"));
console.log(formatAs12HourClock("05:53"));
console.log(formatAs12HourClock("19:36"));
Loading