Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
53f9188
new work space in vscode
Abrsh100 Oct 11, 2025
a825bf7
correctin and updating the exercise
Abrsh100 Oct 13, 2025
d873260
Answering each question with in the file by puting // to separate fro…
Abrsh100 Oct 15, 2025
872131a
solution for sprint 2
Abrsh100 Oct 25, 2025
d139163
Delete Sprint-1/1-key-exercises/1-count.js
Abrsh100 Oct 26, 2025
14f6ab7
Delete Sprint-1/1-key-exercises/2-initials.js
Abrsh100 Oct 26, 2025
3ea986c
Delete Sprint-1/1-key-exercises/3-paths.js
Abrsh100 Oct 26, 2025
7688edc
Delete Sprint-1/2-mandatory-errors/0.js
Abrsh100 Oct 26, 2025
a00d344
Delete Sprint-1/1-key-exercises/4-random.js
Abrsh100 Oct 26, 2025
d336e24
Delete Sprint-1/2-mandatory-errors/1.js
Abrsh100 Oct 26, 2025
5b0207b
Delete Sprint-1/2-mandatory-errors/2.js
Abrsh100 Oct 26, 2025
73b25cc
Delete Sprint-1/2-mandatory-errors/3.js
Abrsh100 Oct 26, 2025
3c5555c
Delete Sprint-1/3-mandatory-interpret/1-percentage-change.js
Abrsh100 Oct 26, 2025
920fa0f
Delete Sprint-1/2-mandatory-errors/4.js
Abrsh100 Oct 26, 2025
eb5face
Delete Sprint-1/3-mandatory-interpret/2-time-format.js
Abrsh100 Oct 26, 2025
f3f4e0b
Delete Sprint-1/3-mandatory-interpret/3-to-pounds.js
Abrsh100 Oct 26, 2025
8448e94
restor sprint 1 from cyf main
Abrsh100 Oct 27, 2025
76ab3c7
correcting the errors based on your valuable comments
Abrsh100 Oct 29, 2025
644248f
communicating the valuable comments
Abrsh100 Oct 30, 2025
ae53e31
changing firstLetter with str
Abrsh100 Oct 31, 2025
f4a96ca
correcting some typos
Abrsh100 Nov 1, 2025
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
8 changes: 4 additions & 4 deletions Sprint-2/1-key-errors/0.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

// =============> write your new code here

function capitalise(str) {
str = `${str[0].toUpperCase()}${str.slice(1)}`;
return str;
function capitalise(firstLetters) {
firstLetters = `${firstLetters[0].toUpperCase()}${firstLetters.slice(1)}`;
return firstLetters;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why changed str to firstLetters?

}
console.log(capitalise("str"))
console.log(capitalise("hello"))
10 changes: 6 additions & 4 deletions Sprint-2/1-key-errors/1.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@

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

/*function convertToPercentage(decimalNumber) {
const decimalNumber = 0.5;
const decimalNumber = 0.5;

function convertToPercentage(decimalNumber) {

const percentage = `${decimalNumber * 100}%`;

return percentage;
}/
}

console.log(decimalNumber);*/
console.log(convertToPercentage(decimalNumber));

// =============> write your explanation here
// A syntaxError has been observed because the decimalNumber is already declared.
Expand Down
3 changes: 2 additions & 1 deletion Sprint-2/3-mandatory-implement/1-bmi.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

function calculateBMI(weight, height) {
const bmi= weight/ (height*height)
return bmi.toFixed(1);
//return bmi.toFixed(1);
// return the BMI of someone based off their weight and height
return Numberbmi.toFixed(1);
}
console.log(calculateBMI(86,1.70));
4 changes: 2 additions & 2 deletions Sprint-2/3-mandatory-implement/2-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// 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 toUpperCase(text) {
return text.toUpperCase();
return text.replace(" ", "_").toUpperCase();
}

console.log(toUpperCase("hello there"));
console.log(toUpperCase("lord of the ring"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does your function work for this function call? Does it output LORD_OF_THE_RING?

console.log(toUpperCase("lord of the ring"));

console.log(toUpperCase("lord_of_the_ring"));
13 changes: 6 additions & 7 deletions Sprint-2/3-mandatory-implement/3-to-pounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@

// You should call this function a number of times to check it works for different inputs
function toPounds(pennies) {
Copy link
Contributor

@cjyuan cjyuan Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter value is expected to be a string in the form "399p" (a sting with a trailing 'p').

const pounds = pennies / 100;
const pounds = (parseInt(pennies.replace("p", ""), 10)) / 100;
return pounds.toFixed(2);
}

// calling the function to make sure it works
console.log(toPounds(32391));
console.log(toPounds(3239));
console.log(toPounds(323));
console.log(toPounds(32));
console.log(toPounds(3));
console.log(toPounds("32391p"));
console.log(toPounds("3239p"));
console.log(toPounds("323p"));
console.log(toPounds("32p"));
console.log(toPounds("3p"));
2 changes: 1 addition & 1 deletion Sprint-2/4-mandatory-interpret/time-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ console.log(formatTimeDisplay(61));

// 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 to num when the pad is called for the last time is "1". */
/* The value assigned to num when the pad is called for the last time is 1. */

// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
// =============> write your answer here
Expand Down
16 changes: 5 additions & 11 deletions Sprint-2/5-stretch-extend/format-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@

function formatAs12HourClock(time) {
const hours = Number(time.slice(0, 2));
if (hours===0) {
return`12:00 am`
}
if (hours===12) {
return `12:00 pm`
}
if (hours > 12) {
return `${hours - 12}:00 pm`;
}
if (hours > 0 && hours < 12)
return `${String(hours).padStart(2, "0")}:00 am`;
const minutes = time.slice(3, 5);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time.slice(-2) is probably more expressive (no need to calculate the starting and ending positions).

const ampm = hours >= 12 ? "pm" : "am";
const Hour = String(hours % 12 === 0 ? 12 : hours % 12).padStart(2, "0")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The convention is to begin a variable name with a lowercase letter.
Name that begins with an uppercase letter is conventionally reserved for data type. For example, String.

return `${Hour}:${minutes} ${ampm}`;
}


const currentOutput = formatAs12HourClock("08:00");
const targetOutput = "08:00 am";
console.assert(
Expand Down