generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 195
Sheffield | May-2025 | WALEED-YAHYA SALIH-TAHA | Sprint-2 #625
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
Bluejay600
wants to merge
15
commits into
CodeYourFuture:main
Choose a base branch
from
Bluejay600:Sprint2-Test-branch
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.
+235
−54
Open
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
156ac50
1. predicted and explained the results of thee three folder in the de…
Bluejay600 a04d5c2
1. predicted the errors in all three folders of key-errors.
Bluejay600 b835363
removed const value to avoid redeclaration.
Bluejay600 15422ea
tested the output of sum (a+b)
Bluejay600 6e684c9
Explained why getLastDigit is not working properly, and corrected t…
Bluejay600 5da4720
created an example usage that and gave it a weight and height to re…
Bluejay600 a4b46e8
1.created a function and gave it a string input,
Bluejay600 00cf79d
Created another example to the same fuction that returns diffrent UPP…
Bluejay600 e476a72
1. Took the code from Sprint-1/interpret/to pounds, and turned it to …
Bluejay600 1dfa784
1. Took the code from Sprint-1/interpret/to pounds, and turned it to …
Bluejay600 8fae862
1. Interpreted the code in time-format.js
Bluejay600 3dbbbb1
1. Wrote tests for as many different groups of input data or edge cases.
Bluejay600 bd4549b
commented with the output result
Bluejay600 e2a37f8
I added a console.log(num); in line 2 and executed the script to fin…
Bluejay600 8595689
Merge branch 'Sprint2-Test-branch' of https://github.com/Bluejay600/M…
Bluejay600 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,24 @@ | ||
// Predict and explain first... | ||
// =============> write your prediction here | ||
// The code will throw an error because the variable 'str' is being redeclared with 'let' inside the function, | ||
// which is not allowed since 'str' is already defined as a parameter of the function. | ||
|
||
// 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)}`; | ||
// return str; | ||
// } | ||
|
||
// =============> write your explanation here | ||
// The error occurs because the variable 'str' is being declared again with 'let' inside the function, | ||
// which conflicts with the parameter 'str' that is already defined. In JavaScript, you cannot redeclare a variable with 'let' in the same scope. | ||
// =============> 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; | ||
} | ||
console.log(capitalise("hello")); // Output: "Hello" | ||
|
||
|
||
// =============> write your explanation here | ||
// =============> write your new code here |
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,14 +1,25 @@ | ||
// Predict and explain first... | ||
|
||
// =============> write your prediction here | ||
// This code will not produce the expected string output. Instead, it will: | ||
// Log the result of the multiplication directly (320) | ||
// Then print:The result of multiplying 10 and 32 is undefined | ||
|
||
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 | ||
// multiply(10, 32) runs inside the template literal. | ||
// Inside the multiply function, console.log(a * b) prints 320 to the console. | ||
// However, the multiply function does not return a value → so it returns undefined by default. | ||
|
||
// Finally, correct the code to fix the problem | ||
//You should return the result from the function instead of logging it directly: | ||
function multiply(a, b) { | ||
return a * b; | ||
} | ||
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); | ||
// =============> write your new code here |
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 | ||
// This code will output: | ||
// The sum of 10 and 32 is undefined | ||
// because the sum function does not return a value. | ||
// 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 | ||
// The sum function does not return a value because the return statement is immediately followed by a semicolon. | ||
// This means the function exits before it can execute the a + b expression. | ||
|
||
// Finally, correct the code to fix the problem | ||
function sum(a, b) { | ||
return a + b; // Corrected to return the sum of a and b | ||
} | ||
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); // Output: The sum of 10 and 32 is 42 | ||
// =============> write your new code here |
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.
Can you also execute the following statement to see if it produce the output you expected?
console.log(convertToPercentage(0.1));
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.
it gives me the same result, because the decimalNumber was declared above so the program ignores the (0.1).
I have now removed the value, so it takes what I have wrote down in thee console.log