-
-
Notifications
You must be signed in to change notification settings - Fork 116
ITP JAN25 | KATARZYNA_KAZIMIERCZUK | STRUCTURING_AND_TESTING_DATA | SPRINT2 #434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 9 commits
9da601e
1318915
c6a0ae7
4583404
4ad6694
4e17876
4c137b3
64169aa
58e1e16
983e0b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
// Predict and explain first... | ||
// =============> write your prediction here | ||
// | ||
// function to capitalize the first letter of a string passed as a parameter | ||
|
||
// call the function capitalise with a string input | ||
// interpret the error message and figure out why an error is occurring | ||
//str has been declared as a param befre being declared | ||
|
||
// function capitalise(str) { | ||
// let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
// return str; | ||
// } | ||
console.log(capitalise("string")); | ||
// =============> write your explanation here | ||
//it happens because tstr is declared twice | ||
|
||
// =============> write your new code here | ||
function capitalise(str) { | ||
let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
return str; | ||
} | ||
|
||
// =============> write your explanation here | ||
// =============> write your new code here |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
// Predict and explain first... | ||
|
||
// =============> write your prediction here | ||
//function does not run but is prining the resut into console | ||
|
||
function multiply(a, b) { | ||
console.log(a * b); | ||
} | ||
// function multiply(a, b) { | ||
// console.log(a * b); | ||
// } | ||
|
||
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); | ||
// console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); | ||
|
||
// =============> write your explanation here | ||
// return the result | ||
|
||
// Finally, correct the code to fix the problem | ||
// =============> write your new code here | ||
const multiply = (a, b) => a*b | ||
|
||
multiply(10, 32) | ||
|
||
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
// Predict and explain first... | ||
// =============> write your prediction here | ||
//return is befror ethe operation and the calculation is a dead code | ||
// function sum(a, b) { | ||
// return; | ||
// a + b; | ||
// } | ||
|
||
function sum(a, b) { | ||
return; | ||
a + b; | ||
} | ||
|
||
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); | ||
// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); | ||
|
||
// =============> write your explanation here | ||
// return a+b | ||
// Finally, correct the code to fix the problem | ||
// =============> write your new code here | ||
|
||
const sum = (a,b) => a+b | ||
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,8 @@ | |
// 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 | ||
|
||
const convertToUpper = (word) => | ||
input.replace(/ /g, "_").console.log(convertToUpper("kaska")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this statement (at line 19) work? |
||
|
||
console.log(convertToUpper("hello hi hi")); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,17 +18,21 @@ function formatTimeDisplay(seconds) { | |
|
||
// a) When formatTimeDisplay is called how many times will pad be called? | ||
// =============> write your answer here | ||
|
||
//3 | ||
// Call formatTimeDisplay with an input of 61, now answer the following: | ||
|
||
// b) What is the value assigned to num when pad is called for the first time? | ||
// =============> write your answer here | ||
// 60 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The answer is not 60. Please retry. |
||
|
||
// c) What is the return value of pad is called for the first time? | ||
// =============> write your answer here | ||
// 00 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the type of the value is a string, we can denote it as |
||
|
||
// 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 | ||
// 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 | ||
// 01 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What type of value do you think the function should return? A number or a string?
Does your function return the type of value you think it should return?