Skip to content

Commit

Permalink
wk 2 feedback implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Feb 20, 2024
1 parent 4caf351 commit 525d065
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion week-2/debug/0.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Predict and explain first...

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

console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
Expand Down
3 changes: 1 addition & 2 deletions week-2/debug/1.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Predict and explain first...

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

console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
Expand Down
4 changes: 1 addition & 3 deletions week-2/debug/2.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Predict and explain first...

let num = 103;

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

Expand Down
3 changes: 2 additions & 1 deletion week-2/errors/0.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ function capitalise(str) {
return str;
}

// str is defined two times, once in function parameter and again in function body, to chnage the error, all we hve to do is remove let from let str and it will work
// error message would be identifier str has already been declared because
//str is defined two times, once in function parameter and again in function body, to chnage the error, all we hve to do is remove let from let str and it will work
10 changes: 5 additions & 5 deletions week-2/implement/cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
// Use the string documentation to help you plan your solution


function text(y){
return y.replaceAll(" ","_").toUpperCase();
function convertToUpperCaseCamelCase(inputStr){
return inputStr.replaceAll(" ","_").toUpperCase();
}

console.log(text("lord of the rings"));
console.log(text("the great gatsby"));
console.log(text("the da vinci code"));
console.log(convertToUpperCaseCamelCase("lord of the rings"));
console.log(convertToUpperCaseCamelCase("the great gatsby"));
console.log(convertToUpperCaseCamelCase("the da vinci code"));
8 changes: 4 additions & 4 deletions week-2/implement/to-pounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Call this function a number of times to check it works for different inputs


function money(penceString){
function penceToPounds(penceString){

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

Expand All @@ -17,6 +17,6 @@ const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length -
return${pounds}.${pence}`;
}

console.log(money("489p"));
console.log(money("6349p"));
console.log(money("73p"));
console.log(penceToPounds("489p"));
console.log(penceToPounds("6349p"));
console.log(penceToPounds("73p"));

0 comments on commit 525d065

Please sign in to comment.