generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 195
London|May-2025|Alexandru Pocovnicu|Structuring and testing data/Coursework/sprint 2 #514
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
Open
alexandru-pocovnicu
wants to merge
19
commits into
CodeYourFuture:main
Choose a base branch
from
alexandru-pocovnicu:coursework/sprint-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e170c4c
made my prediction and corrected the code on line 8, removed 'let'
alexandru-pocovnicu 5b4a506
made a prediction(wrong) and corrected the code
alexandru-pocovnicu 4f6fb22
made a prediction, changed the code
alexandru-pocovnicu 0e85fa5
made my prediction and corrected the code
alexandru-pocovnicu 36eab2f
made my prediction, corrected the code
alexandru-pocovnicu 36ee959
made a prediction ( i am something of a nostradamus by now) corrected…
alexandru-pocovnicu 501c5d5
wrote a function to find out my bmi
alexandru-pocovnicu 7e0e2e8
converted a string to snake upper case
alexandru-pocovnicu 0588bc9
turned the code in to one fuction called toPounds
alexandru-pocovnicu 9286c0e
i interpreted the functions and wrote the answers in the comments
alexandru-pocovnicu 41ab3ae
i wrote tests for as many edge cases i cold think of and fixed the bu…
alexandru-pocovnicu 0e4dc60
updated the answer for the first question
alexandru-pocovnicu c5909c1
deleted decimalNumber=o.5
alexandru-pocovnicu 70ce1a9
corrected my prediction
alexandru-pocovnicu 541e4f9
added a value to the console.log to check if it works
alexandru-pocovnicu e1a40af
added assert for 23:45
alexandru-pocovnicu 1d99926
added assert for 13:30
alexandru-pocovnicu fc95e06
added assert and code for 00:00
alexandru-pocovnicu fcde0f6
fix: correct comparison for hours in formatAs12HourClock function
alexandru-pocovnicu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
// Predict and explain first... | ||
// =============> write your prediction here | ||
// =============> write your prediction here: "str" is already used as a parameter , i don't know if we gonna get an error or undefined | ||
|
||
// call the function capitalise with a string input | ||
// interpret the error message and figure out why an error is occurring | ||
|
||
function capitalise(str) { | ||
let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
return str; | ||
} | ||
capitalise("hello"); | ||
// =============> write your explanation here: the error occurs because "str" has already been declared when was used as a parameter | ||
|
||
// =============> write your explanation here | ||
// =============> write your new code here | ||
/* =============> write your new code here: | ||
function capitalise(str) { | ||
str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
return str; | ||
} | ||
capitalise("hello");*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
// Predict and explain first... | ||
|
||
// Why will an error occur when this program runs? | ||
// =============> write your prediction here | ||
/* =============> write your prediction here: because on line 11 | ||
decimalNumber is already used as parameter so it can't be declared again inside the function*/ | ||
|
||
// Try playing computer with the example to work out what is going on | ||
|
||
function convertToPercentage(decimalNumber) { | ||
const decimalNumber = 0.5; | ||
/*function convertToPercentage(decimalNumber) { | ||
//decimalNumber = 0.5; | ||
const percentage = `${decimalNumber * 100}%`; | ||
|
||
return percentage; | ||
} | ||
|
||
console.log(decimalNumber); | ||
|
||
console.log(convertToPercentage(7));//ReferenceError: decimalNumber is not defined | ||
console.log(convertToPercentage(0.5)); | ||
// =============> write your explanation here | ||
|
||
// Finally, correct the code to fix the problem | ||
// =============> write your new code here | ||
=============> write your new code here:*/ | ||
function convertToPercentage(decimalNumber) { | ||
|
||
const percentage = `${decimalNumber * 100}%`; | ||
|
||
return percentage; | ||
} | ||
console.log(convertToPercentage(0.5)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
// Predict and explain first... | ||
|
||
// =============> write your prediction here | ||
|
||
function multiply(a, b) { | ||
// =============> write your prediction here: instead of "console.log(a * b);" should be "return..", might get undefined | ||
/*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 | ||
// =============> write your explanation here:instead of "console.log(a * b);" should be "return.." | ||
|
||
// Finally, correct the code to fix the problem | ||
// =============> write your new code here | ||
function multiply(a, b) { | ||
return (a * b); | ||
} | ||
|
||
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
// Predict and explain first... | ||
// =============> write your prediction here | ||
// =============> write your prediction here: Syntax error: The sum of 10 and 32 is undefined | ||
|
||
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 | ||
// Finally, correct the code to fix the problem | ||
// =============> write your explanation here: the function will return 'undefined' because there is nothing coming after 'return' | ||
// =============> write your new code here | ||
function sum(a, b) { | ||
return a + b; | ||
|
||
} | ||
|
||
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
// Predict and explain first... | ||
|
||
// Predict the output of the following code: | ||
// =============> Write your prediction here | ||
// =============> Write your prediction here:3,3,3 | ||
|
||
const num = 103; | ||
//const num = 103; | ||
|
||
function getLastDigit() { | ||
/*function getLastDigit(num) { | ||
return num.toString().slice(-1); | ||
} | ||
|
||
console.log(`The last digit of 42 is ${getLastDigit(42)}`); | ||
console.log(`The last digit of 105 is ${getLastDigit(105)}`); | ||
console.log(`The last digit of 806 is ${getLastDigit(806)}`); | ||
console.log(`The last digit of 806 is ${getLastDigit(806)}`);*/ | ||
|
||
// Now run the code and compare the output to your prediction | ||
// =============> write the output here | ||
// Explain why the output is the way it is | ||
// =============> write your explanation here | ||
// =============> write the output here: | ||
/*The last digit of 42 is 3 | ||
The last digit of 105 is 3 | ||
The last digit of 806 is 3*/ | ||
// Explain why the output is the way it is: | ||
// =============> write your explanation here: because the const num has been assigned the value 103 and that's the value the fuction always uses | ||
// Finally, correct the code to fix the problem | ||
// =============> write your new code here | ||
// =============> write your new code here: | ||
function getLastDigit(num) { | ||
return num.toString().slice(-1); | ||
} | ||
|
||
console.log(`The last digit of 42 is ${getLastDigit(42)}`); | ||
console.log(`The last digit of 105 is ${getLastDigit(105)}`); | ||
console.log(`The last digit of 806 is ${getLastDigit(806)}`); | ||
|
||
// This program should tell the user the last digit of each number. | ||
// Explain why getLastDigit is not working properly - correct the problem | ||
// Explain why getLastDigit is not working properly - correct the problem: see above-line 22 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.