Skip to content

Commit eb6c519

Browse files
committed
expressed value proper in double quotes and added indentation
1 parent d252252 commit eb6c519

File tree

8 files changed

+32
-34
lines changed

8 files changed

+32
-34
lines changed

Sprint-2/1-key-errors/0.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3-
// The function when called was supposed to capitalise the first letter of a string by calling the first character of the string and then transforming
3+
// The function when called was supposed to capitalise the first letter of a string by calling the first character of the string and then transforming
44
// to uppercase character and adding it back to the string, but because the variable "str" had already been declared it going to throw a syntaxerror
55

66
// call the function capitalise with a string input
@@ -23,4 +23,4 @@ function capitalise(str) {
2323
let capitalisedStr = `${str[0].toUpperCase()}${str.slice(1)}`;
2424
return capitalisedStr;
2525
}
26-
console.log(capitalise("tell me about yourself"))
26+
console.log(capitalise("tell me about yourself"));

Sprint-2/1-key-errors/2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
// =============> write your new code here
2424

2525
function square(num) {
26-
return num * num;
26+
return num * num;
2727
}
2828
console.log(square(10));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ function multiply(a, b) {
1717
return a * b;
1818
}
1919

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

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// Explain why the output is the way it is
2020
// =============> write your explanation here
2121
//getLastDigit takes no parameters.
22-
//Inside the function, will always return the last digit of the global variable num, which is "3".
22+
//Inside the function, will always return the last digit of the global variable num, which is "3".
2323

2424
// Finally, correct the code to fix the problem
2525
// =============> write your new code here
@@ -28,7 +28,6 @@
2828
// Explain why getLastDigit is not working properly - correct the problem
2929
//Every call ignores the number that is passed in the argument and just returns "3"
3030

31-
3231
function getLastDigit(num) {
3332
return num.toString().slice(-1);
3433
}

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

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

1717
function calculateBMI(weight, height) {
18-
// return the BMI of someone based off their weight and height
19-
const bmi = weight/(height*height);
20-
const convertedBmi = Number(bmi.toFixed(1));
21-
return convertedBmi;
22-
18+
// return the BMI of someone based off their weight and height
19+
const bmi = weight / (height * height);
20+
const convertedBmi = Number(bmi.toFixed(1));
21+
return convertedBmi;
2322
}
24-
console.log (calculateBMI(70, 1.73))
23+
console.log(calculateBMI(70, 1.73));
2524
console.log(typeof calculateBMI());

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
// Use the MDN string documentation to help you find a solution
1616
// This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase
1717

18-
function toUpperSnakeCase(str){
19-
const strTransform = str.replaceAll(" ", "_").toUpperCase();
20-
return strTransform;
18+
function toUpperSnakeCase(str) {
19+
const strTransform = str.replaceAll(" ", "_").toUpperCase();
20+
return strTransform;
2121
}
2222
console.log(toUpperSnakeCase("lord of the rings"));

Sprint-2/3-mandatory-implement/3-to-pounds.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@
55

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

8-
function toPounds(penceString){
9-
const penceStringWithoutTrailingP = penceString.substring(
10-
0,
11-
penceString.length - 1
12-
);
8+
function toPounds(penceString) {
9+
const penceStringWithoutTrailingP = penceString.substring(
10+
0,
11+
penceString.length - 1
12+
);
1313

14-
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
15-
const pounds = paddedPenceNumberString.substring(
16-
0,
17-
paddedPenceNumberString.length - 2
18-
);
14+
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
15+
const pounds = paddedPenceNumberString.substring(
16+
0,
17+
paddedPenceNumberString.length - 2
18+
);
1919

20-
const pence = paddedPenceNumberString
21-
.substring(paddedPenceNumberString.length - 2)
22-
.padEnd(2, "0");
20+
const pence = paddedPenceNumberString
21+
.substring(paddedPenceNumberString.length - 2)
22+
.padEnd(2, "0");
2323

24-
return ${pounds}.${pence}`;
24+
return ${pounds}.${pence}`;
2525
}
2626
console.log(toPounds("3p"));
2727
console.log(toPounds("399p"));
2828
console.log(toPounds("3999999p"));
29-
console.log(toPounds("3999999999999999p"));
29+
console.log(toPounds("3999999999999999p"));

Sprint-2/4-mandatory-interpret/time-format.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ console.log(formatTimeDisplay(61));
2424
// Call formatTimeDisplay with an input of 61, now answer the following:
2525
// b) What is the value assigned to num when pad is called for the first time?
2626
// =============> write your answer here
27-
// The first call to pad() is 0, for totalHours which is 0
27+
// The first call to pad() is "0", for totalHours which is "0"
2828

2929
// c) What is the return value of pad is called for the first time?
3030
// =============> write your answer here
31-
// The return value is 00
31+
// The return value is "00"
3232

3333
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3434
// =============> write your answer here
35-
// 1: -> pad() was called from line 11. Given that num is 0, the first call to pad() (for totalHours which is 0). There were two more calls to pad()(for remainingLastMinutes and remaining LastSeconds) and the value assigned to num for the last call is 0
35+
// 1: -> pad() was called from line 11. Given that num is "0", the first call to pad() (for totalHours which is "0"). There were two more calls to pad()(for remainingLastMinutes and remaining LastSeconds) and the value assigned to num for the last call is "0"
3636

3737
// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
3838
// =============> write your answer here
39-
//01 -> Given that num is 1, the last call to pad() (for remainingSeconds is 1) and the return value is 01,
39+
//01 -> Given that num is 1, the last call to pad() (for remainingSeconds is 1) and the return value is "01"

0 commit comments

Comments
 (0)