Skip to content

Commit df570d3

Browse files
formatted all the files with prettier
1 parent 38f5a35 commit df570d3

9 files changed

Lines changed: 32 additions & 40 deletions

File tree

‎Sprint-3/1-key-errors/0.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ As we can see the str variable has already been declared in the prameter of the
1919

2020
// =============> write your new code here
2121
function capitalise(str) {
22-
return str[0].toUpperCase()+str.slice(1);
23-
22+
return str[0].toUpperCase() + str.slice(1);
2423
}
2524
console.log(capitalise("ebrahim"));
26-
console.log(capitalise('salomi'));
25+
console.log(capitalise("salomi"));

‎Sprint-3/1-key-errors/1.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ As the decimalNumber inside the function we can't print it using the console.log
2222
instead we can delete the second declaration and just leave the parameter as an input for the user
2323
*/
2424

25-
26-
// Finally, correct the code to fix the problem
25+
// Finally, correct the code to fix the problem
2726

2827
// =============> write your new code here
2928
function convertToPercentage(decimalNumber) {
3029
const percentage = `${decimalNumber * 100}%`;
3130
return percentage;
3231
}
3332

34-
console.log(convertToPercentage(0.5));
33+
console.log(convertToPercentage(0.5));

‎Sprint-3/2-mandatory-debug/0.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Predict and explain first...
22

33
// =============> write your prediction here
4-
// This function would multiply the two arguments a and b
5-
// when we log the output we will get the string and the output of the function but because we are not returning an output we might run into an error
4+
// This function would multiply the two arguments a and b
5+
// when we log the output we will get the string and the output of the function but because we are not returning an output we might run into an error
66

77
// function multiply(a, b) {
88
// console.log(a * b);
@@ -11,7 +11,7 @@
1111
// console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1212

1313
// =============> write your explanation here
14-
//The console.log() inside the function will print a*b but when we call the function will return the out put and undefined
14+
//The console.log() inside the function will print a*b but when we call the function will return the out put and undefined
1515
// but after the fix of returning instead it will be working giving the result in that instance will get 320
1616

1717
// Finally, correct the code to fix the problem
@@ -22,4 +22,4 @@ function multiply(a, b) {
2222

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

25-
console.log(multiply(10,32))
25+
console.log(multiply(10, 32));

‎Sprint-3/2-mandatory-debug/1.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// =============> write your prediction here
33
// The function suppose to return the sum of the two variables but we will encounter an error as the code after return is unreachable.
44

5-
65
// function sum(a, b) {
76
// return;
87
// a + b;
@@ -20,4 +19,4 @@ function sum(a, b) {
2019
return a + b;
2120
}
2221

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ console.log(`The last digit of 806 is ${getLastDigit(806)}`);
4242
/* the reason why getLastDigit isn't working properly is that it doesn't accept any arrguments where there isn't any perameters in its difination.
4343
where it uses the golabal varaible 'num' decalred outside the funtion and already set to 103
4444
45-
The correct code includes a parameter 'num' in the difination this allows the function to accept the number passed to it when called*/
45+
The correct code includes a parameter 'num' in the difination this allows the function to accept the number passed to it when called*/

‎Sprint-3/3-mandatory-implement/1-bmi.js‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
// It should return a string of their Body Mass Index to 1 decimal place
1616

1717
function calculateBMI(weight, height) {
18-
let result = (weight/(height*height)).toFixed(1);
19-
return String(result)
20-
21-
18+
let result = (weight / (height * height)).toFixed(1);
19+
return String(result);
2220
}
2321

24-
console.log(calculateBMI(81, 1.8))
22+
console.log(calculateBMI(81, 1.8));

‎Sprint-3/3-mandatory-implement/2-cases.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ function toUpperSnakeCase(string) {
1818
return string.toUpperCase().replaceAll(" ", "_");
1919
}
2020
console.log(toUpperSnakeCase("hello there"));
21-
console.log(toUpperSnakeCase("lord of the rings"));
21+
console.log(toUpperSnakeCase("lord of the rings"));
Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
// In Sprint-1, there is a program written in in 3-mandatory-interpret/3-to-pounds.js.
22

3-
4-
53
// You will need to take this code and turn it into a reusable block of code.
64
// You will need to declare a function called toPounds with an appropriately named parameter.
75

86
// You should call this function a number of times to check it works for different inputs
9-
function toPounds(penceString){
10-
const penceStringWithoutTrailingP = penceString.substring(
11-
0,
12-
penceString.length - 1
13-
);
14-
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
15-
const pounds = paddedPenceNumberString.substring(
16-
0,
17-
paddedPenceNumberString.length - 2
18-
);
7+
function toPounds(penceString) {
8+
const penceStringWithoutTrailingP = penceString.substring(
9+
0,
10+
penceString.length - 1,
11+
);
12+
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
13+
const pounds = paddedPenceNumberString.substring(
14+
0,
15+
paddedPenceNumberString.length - 2,
16+
);
1917

20-
const pence = paddedPenceNumberString
21-
.substring(paddedPenceNumberString.length - 2)
22-
.padEnd(2, "0");
18+
const pence = paddedPenceNumberString
19+
.substring(paddedPenceNumberString.length - 2)
20+
.padEnd(2, "0");
2321
return `£${pounds}.${pence}`;
24-
}
25-
22+
}
2623

27-
console.log(toPounds('987p'));
28-
console.log(toPounds('9p'));
29-
console.log(toPounds('50p'));
24+
console.log(toPounds("987p"));
25+
console.log(toPounds("9p"));
26+
console.log(toPounds("50p"));

‎Sprint-3/4-mandatory-interpret/time-format.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ console.log(formatTimeDisplay(61));
3838

3939
// e) What is the return value of pad when it is called for the last time in this program? Explain your answer
4040
// =============> 01
41-
// the return value is 1 but as we are using pad would be adding a leading of 0 to become 01
41+
// the return value is 1 but as we are using pad would be adding a leading of 0 to become 01

0 commit comments

Comments
 (0)