generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 195
London | May-2025 | Fatima Z Belkedari | Module Structuring and Testing Data | Sprint 2 #610
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
Farah-Stu
wants to merge
20
commits into
CodeYourFuture:main
Choose a base branch
from
Farah-Stu: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
20 commits
Select commit
Hold shift + click to select a range
4bd74de
fixing the code's error
Farah-Stu 44ace2e
updating the changes
Farah-Stu 25fabb9
fixing the percentage error exercises
Farah-Stu a821c8a
updating key errors
Farah-Stu 09946c7
updating mandatory debug
Farah-Stu 4aa5b75
debugging and fixing the errors
Farah-Stu d1108da
fixing the errors
Farah-Stu ab80854
Calculating BMI
Farah-Stu c75bbc9
Uppersnake case
Farah-Stu 1a41b29
Update to.pounds
Farah-Stu 312181c
update time-format
Farah-Stu 55fd5b6
updating time format
Farah-Stu 57ddac2
fixing a typo
Farah-Stu 3da97a3
update the upperCase file
Farah-Stu 90d05b0
debugging and fixing the issue
Farah-Stu 13e562d
removing the brackets
Farah-Stu 7e4b084
updating the last digit file
Farah-Stu 32fa914
Amending to decimal number
Farah-Stu 2ee4da2
fixing conole.log issue
Farah-Stu 5a9be36
Updating the toFixed function
Farah-Stu 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,22 @@ | ||
// Predict and explain first... | ||
// =============> write your prediction here | ||
// The instruction wants to define a function with the input (str) | ||
|
||
// call the function capitalise with a string input | ||
// interpret the error message and figure out why an error is occurring | ||
// the error is in the use of let str. (str) is already an input and you can't use it again. | ||
|
||
|
||
function capitalise(str) { | ||
let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
return str; | ||
} | ||
|
||
// =============> write your explanation here | ||
//In order to fix the problem we need to declare let with capitalise instead of str. | ||
// Because if we use the parameter (str), it creates a naming conflict in the same scope. | ||
|
||
|
||
// =============> write your new code here | ||
|
||
function capitlise(str) { | ||
let capitalise =`${str[0].toUpperCase()}${str.slice(1)}`; | ||
return capitalise; | ||
} | ||
console.log(capitlise("good")); |
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,20 +1,29 @@ | ||
|
||
// Predict and explain first BEFORE you run any code... | ||
//I think we should define number first before returning it. | ||
|
||
// this function should square any number but instead we're going to get an error | ||
|
||
// =============> write your prediction of the error here | ||
// =============> write your prediction of the error here. | ||
//number undefined. | ||
|
||
|
||
function square(3) { | ||
return num * num; | ||
} | ||
|
||
// =============> write the error message here | ||
|
||
//Unexpected number | ||
// =============> explain this error message here | ||
|
||
// It is not allowed to use numbers in a variable parameter. | ||
// Finally, correct the code to fix the problem | ||
|
||
// =============> write your new code here | ||
|
||
|
||
function square(number) { | ||
const result = number * number; | ||
return result; | ||
} | ||
|
||
console.log(square(3)); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,39 @@ | ||
// Predict and explain first... | ||
|
||
// Predict the output of the following code: | ||
//I think the result would be 3 for 42, 105 and 806 because cost num is declared outside the function | ||
// in the global scope. And this means any input would take the result of the global scope. | ||
// Predict the output of the following code:3 | ||
// =============> Write your prediction here | ||
// the result would be 3 for 42, 105 and 806. Because cost num =103 is defined outside the function. | ||
|
||
const num = 103; | ||
|
||
function getLastDigit() { | ||
function getLastDigit()) { | ||
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)}`); | ||
|
||
// 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 the output here: the last digit of 42, 105 and 806 is 3 | ||
// Explain why the output is the way it is. Because when we declared the variable const num =103 it is outside the function(global variable) | ||
// so everytime we call the function, it will use the 103 as a reference. | ||
// =============> write your explanation here | ||
// The use of global variable outside the function doesn't accept any arguments. It always refers back to 103 and | ||
// return the last digit which is 3 | ||
// Finally, correct the code to fix the problem | ||
// =============> write your new code here | ||
|
||
function getTheLastDigit(number){ | ||
return number.toString().slice(-1); | ||
|
||
} | ||
console.log(`The last digit of 42 is ${getTheLastDigit(42)}`); | ||
console.log(`The last digit of 105 is ${getTheLastDigit(105)}`); | ||
console.log(`The last digit of 806 is ${getTheLastDigit(806)}`); | ||
|
||
// This program should tell the user the last digit of each number. | ||
// Explain why getLastDigit is not working properly - correct the problem |
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.
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.
Does this function name follow the usual camelCase convention?
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.
No, it does not. "camelCase" starts with a small lowercase letter and each new word starts with capital letter.