Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion Sprint-1/2-mandatory-errors/1.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// trying to create an age variable and then reassign the value by 1

const age = 33;
let age = 33;
age = age + 1;
console.log (age)
2 changes: 1 addition & 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 Down
7 changes: 5 additions & 2 deletions Sprint-2/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 their Body Mass Index to 1 decimal place

function calculateBMI(weight, height) {
// return the BMI of someone based off their weight and height
}
let heightsq = height * height;
return weight/heightsq;
// return the BMI of someone based off their weight and height
}
console.log(calculateBMI(30, 10));
7 changes: 7 additions & 0 deletions Sprint-2/3-mandatory-implement/2-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@
// 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

function SNAKE_CASE (mesasge){
let snake = mesasge.replace(/ /g,"_");
let upper = snake.toUpperCase();
return upper;
}
console.log(SNAKE_CASE("hello there"));
11 changes: 11 additions & 0 deletions Sprint-2/3-mandatory-implement/3-to-pounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@
// 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) {
let penceStringWithoutTrailingP = penceString.replace( /[^1-9]/g, ""); //39772
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); //39772
const pounds = paddedPenceNumberString.substring( 0, paddedPenceNumberString.length - 2 ); // 397
const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2)
.padEnd(2, "0"); // 72
return `£${pounds}.${pence}`; // 397.72

}
console.log(toPounds("397d72p"));
34 changes: 0 additions & 34 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.

41 changes: 0 additions & 41 deletions Sprint-2/readme.md

This file was deleted.

Loading