generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 241
London | Sep-2025 | Gislaine Della Bella | Sprint 2 | coursework-sprint-2 #759
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
Della-Bella
wants to merge
14
commits into
CodeYourFuture:main
Choose a base branch
from
Della-Bella: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 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
83c273b
Start Excercises sprint 2
Della-Bella ced9817
Start Excercises Sprint 2
Della-Bella a2d891a
SyntaxError Identifier has already been declared / FIX
Della-Bella 812cf83
Fix : ****pass values into the function when you call it, not when yo…
Della-Bella b9391ff
Add Return to scope of the Function
Della-Bella 0440a7f
Fix scope of the function
Della-Bella 7fd4ee0
Fix function input
Della-Bella 7d6b8da
Fix SyntaxError
Della-Bella bd99bf5
Learn toFixed & parseFloat
Della-Bella 054d3ac
practice spllit() & join() & toUpperCase()
Della-Bella 63a51e6
Practicing Time
Della-Bella 1802806
testing Assert
Della-Bella 71f49ba
Practice Reusable Function Syntax
Della-Bella 94d39b3
Reviews done
Della-Bella 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,25 @@ | ||
| // Predict and explain first... | ||
| // =============> write your prediction here | ||
| // =============> looking at it I think the sytntaks is worng return; a+b; | ||
|
|
||
| // function sum(a, b) { | ||
| // return; | ||
| // a + b; | ||
| // } | ||
|
|
||
| // console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); | ||
|
|
||
| // =============> | ||
| // I declare in the scope of function what a,b need to do return | ||
| // call the function with the template literal | ||
| // wich will give me the Text sentence with the result of any sum | ||
|
|
||
| // Finally, correct the code to fix the problem | ||
| // =============> | ||
|
|
||
| function sum(a, b) { | ||
| return; | ||
| a + b; | ||
| const newSum = a + b; | ||
| return newSum; | ||
|
|
||
| } | ||
|
|
||
| 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 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,24 +1,42 @@ | ||
| // Predict and explain first... | ||
|
|
||
| // Predict the output of the following code: | ||
| // =============> Write your prediction here | ||
| // =============> it is declaring num fisrt wich wil work but the function will stop after the | ||
| //calculate 103 results. after run Return if the results. | ||
|
|
||
| const num = 103; | ||
| // I din't predict rigt it gives the results all using the const Num= 103 | ||
|
|
||
| function getLastDigit() { | ||
| return num.toString().slice(-1); | ||
| } | ||
| // the consolo.log wont work | ||
|
|
||
| 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)}`); | ||
| // const num = 103; | ||
|
|
||
| // 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 your explanation here | ||
| // =============> it is using the const 103 for all the results | ||
|
|
||
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
|
|
||
| // This program should tell the user the last digit of each number. | ||
| // Explain why getLastDigit is not working properly - correct the problem | ||
|
|
||
|
|
||
| function getLastDigit(numtoCalculate) { //give a input to the function to use | ||
| const num = numtoCalculate.toString().slice(-1); //declare a const adding values to what to do | ||
| return num; // return the process | ||
| } | ||
|
|
||
| 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)}`); | ||
|
|
||
| //output | ||
| // The last digit of 42 is 2 | ||
| // The last digit of 105 is 5 | ||
| // The last digit of 806 is 6 |
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 |
|---|---|---|
|
|
@@ -14,3 +14,21 @@ | |
| // 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 | ||
|
|
||
|
|
||
| //1- methodo that take space add _ ? | ||
| //2- methodo find first index of ech word | ||
| //3- methodo to tranform string to upercase = toUpperCase() | ||
| //4- return the value | ||
|
|
||
|
|
||
|
|
||
| function takeSapcestoUpercase (textSnake){ | ||
|
|
||
| let takespace = textExemple.split(" ");// returns array nned to tranform to string again before upercase | ||
|
||
| let transfStringAgain = takespace.join("_"); | ||
| let changeUper = transfStringAgain.toUpperCase(1); | ||
| return changeUper; | ||
| }; | ||
| let textExemple = "hello there"; | ||
| console.log(takeSapcestoUpercase(textExemple)); | ||
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,6 +1,43 @@ | ||
| // In Sprint-1, there is a program written in interpret/to-pounds.js | ||
|
|
||
| // You will need to take this code and turn it into a reusable block of code. | ||
|
|
||
| // need to get car price = let fullPrice | ||
| //need get priceOneyear= let priceOneyear | ||
| // need take the spaces off the both variables | ||
| //need check the diference of the prices | ||
| //multiplay the result for 100 to check the percentage | ||
| // return the result with template literals | ||
|
|
||
| //function needs to be valid with diferents inputs | ||
|
|
||
| // You will need to declare a function called toPounds with an appropriately named parameter. | ||
|
|
||
| // You should call this function a number of times to check it works for different inputs | ||
|
|
||
|
|
||
| // let carPrice = "10,000"; | ||
| // let priceAfterOneYear = "8,543"; | ||
|
|
||
| // carPrice = Number(carPrice.replaceAll(",", ""));// 10000 | ||
| // priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",","")); //8543 | ||
|
|
||
| // const priceDifference = carPrice - priceAfterOneYear; //1457 | ||
| // const percentageChange = (priceDifference / carPrice) * 100; //145700 | ||
|
|
||
| // console.log(`The percentage change is ${percentageChange}`); //14.57 | ||
|
|
||
| function toPounds(fullPrice, priceOneyear) { | ||
|
|
||
| fullPrice = Number(fullPrice.replaceAll(",", "")); | ||
| priceOneyear = Number(priceOneyear.replaceAll(",", "")); | ||
|
|
||
| const priceDifference = fullPrice - priceOneyear; | ||
|
|
||
| const percentageChange = (priceDifference / fullPrice) * 100; | ||
|
|
||
| // console.log(`The percentage change is ${percentageChange}`); | ||
| return percentageChange; | ||
| } | ||
|
|
||
| console.log (toPounds( "100,000", "98,000")); |
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
Oops, something went wrong.
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.
Could you resolve this using a single line rather than 2 lines?
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.
done 👍
function multiply(num1, num2) {
return num1 * num2;
}
console.log(
The result of multiplying 10 and 32 is ${multiply(10, 32)});