-
-
Notifications
You must be signed in to change notification settings - Fork 546
London | 26-ITP-Sep | Chandaramani Gaire | Sprint 2 | Sprint 2 Coursework #1575
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
Closed
gaireprakash20-ops
wants to merge
18
commits into
CodeYourFuture:main
from
gaireprakash20-ops:Sprint-2
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
bd936fc
Key excercises for sprint 2
gaireprakash20-ops 7b9e573
second commit for sprint change
gaireprakash20-ops 878dae9
first formula related file in javascript
gaireprakash20-ops 982244f
chrome and objects commit
gaireprakash20-ops a6a40aa
changes
gaireprakash20-ops 3fbdf03
line tag corrected
gaireprakash20-ops 9aa6672
deleted the "" from CKJ
gaireprakash20-ops 63fbd50
Math.floor missing answer
gaireprakash20-ops 453e086
put let varible except const
gaireprakash20-ops 7ab1778
edit
gaireprakash20-ops e211f67
console change let
gaireprakash20-ops 62fa645
Reference error is not fixed
gaireprakash20-ops c32753d
placed the number at the end
gaireprakash20-ops 294f0f5
explain the percentage meaning
gaireprakash20-ops cb44a34
explain that how to get exact time
gaireprakash20-ops 84b913c
test the two different negative and decimal
gaireprakash20-ops a92c307
test the two different negative and decimal
gaireprakash20-ops 0a80be3
Merge branch 'Sprint-2' of https://github.com/gaireprakash20-ops/Modu…
gaireprakash20-ops 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,9 @@ | ||
| const firstName = "Creola"; | ||
| const middleName = "Katherine"; | ||
| const lastName = "Johnson"; | ||
|
|
||
| // Declare a variable called initials that stores the first character of each string. | ||
| // This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution. | ||
|
|
||
| const initials = ``; | ||
|
|
||
| // https://www.google.com/search?q=get+first+character+of+string+mdn | ||
| const initials = `${firstName.charAt(0)}${middleName.charAt(0)}${lastName.charAt(0)}`; | ||
| console.log(initials) | ||
| // // https://www.google.com/search?q=get+first+character+of+string+mdn |
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,2 +1,3 @@ | ||
| This is just an instruction for the first activity - but it is just for human consumption | ||
| We don't want the computer to run these 2 lines - how can we solve this problem? | ||
| /*This is just an instruction for the first activity - but it is just for human consumption | ||
| We don't want the computer to run these 2 lines - how can we solve this problem? | ||
| for single line we used // and for multiple line use */ |
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,4 +1,11 @@ | ||
| // trying to create an age variable and then reassign the value by 1 | ||
|
|
||
| const age = 33; | ||
| let age = 33; | ||
| age = age + 1; | ||
|
|
||
| console.log(age); | ||
|
|
||
| /* In this case age is not const means variable is not reassigned so that, | ||
| /*we throws a TypeError: Assignment to constant variable*/ | ||
| //I try by let where console.log(age) shows Running] node "c:\Users\Desktop\code your future\Module-Onboarding\Module-JavaScript-Fundamentals\Sprint-2\Sprint-2\2-mandatory-errors\1.js" | ||
| //34. |
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,9 +1,14 @@ | ||
| const cardNumber = 4533787178994213; | ||
| const last4Digits = cardNumber.slice(-4); | ||
| const last4Digits = String(cardNumber).slice(-4); | ||
| console.log (last4Digits); | ||
|
|
||
| // The last4Digits variable should store the last 4 digits of cardNumber | ||
| // However, the code isn't working | ||
| // Before running the code, make and explain a prediction about why the code won't work | ||
| // Then run the code and see what error it gives. | ||
| // Consider: Why does it give this error? Is this what I predicted? If not, what's different? | ||
| // Consider: Why does it give this error? Is this what I predicted? If not, what's different? | ||
| // Then try updating the expression last4Digits is assigned to, in order to get the correct value | ||
| //Card number is a number not a string so it will throw typeerror. | ||
| // i did not think slice method can not run in number method so that i change it in string | ||
| // when i put capital letter ReferenceError: string is not defined so that nothing last4Digits not showed | ||
| //in the terminal String is the function but string is the normal text. |
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,2 +1,6 @@ | ||
| const 12HourClockTime = "8:53pm"; | ||
| const 24hourClockTime = "20:53"; | ||
| const HourClockTime12 = "8:53pm"; | ||
| const hourClockTime24 = "20:53"; | ||
|
|
||
|
|
||
| /*variable is not start with number show syntaxerror.*/ | ||
| // i just move the number at the end. |
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 |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ let carPrice = "10,000"; | |
| let priceAfterOneYear = "8,543"; | ||
|
|
||
| carPrice = Number(carPrice.replaceAll(",", "")); | ||
| priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); | ||
| priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",","")); | ||
|
|
||
| const priceDifference = carPrice - priceAfterOneYear; | ||
| const percentageChange = (priceDifference / carPrice) * 100; | ||
|
|
@@ -12,11 +12,24 @@ console.log(`The percentage change is ${percentageChange}`); | |
| // Read the code and then answer the questions below | ||
|
|
||
| // a) How many function calls are there in this file? Write down all the lines where a function call is made | ||
|
|
||
| // b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? | ||
|
|
||
| // c) Identify all the lines that are variable reassignment statements | ||
|
|
||
| // d) Identify all the lines that are variable declarations | ||
|
|
||
| // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? | ||
| /* there has five function in line 4 and and console . log also has one | ||
|
Contributor
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. Your answers here are right. But this |
||
| line 4 and 5 has two Number() function | ||
| line 4 and 5 has two replaceALL() function | ||
| line 10 has one console . log () | ||
|
|
||
| /* b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? | ||
| In line five error shown in replaceAll("," "")); missing comma before last two comma(",",""). | ||
|
|
||
| /* c) Identify all the lines that are variable reassignment statements | ||
| line 4 carPrice = Number(carPrice.replaceAll(",", "")); | ||
| line 5 priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", "")); | ||
| As per the carPrice and priceAfterOneYear has been declared in line 1 and 2 by using let variable. | ||
|
|
||
| /*d) Identify all the lines that are variable declarations | ||
| line 1 let carPrice = "10,000"; | ||
| line 2 let priceAfterOneYear = "8,543"; | ||
| line 7 const priceDifference = carPrice - priceAfterOneYear; | ||
| line 8 const percentageChange = (priceDifference / carPrice) * 100; | ||
|
|
||
| /* e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? | ||
| replaceALL throwout all the commas from the string and number became numerical value. | ||
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
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.
Line 13 starts in the middle of a sentence. I think it is about
Math.floor. Please finish it.Two steps are also missing.
Math.random() * (maximum - minimum + 1)isMath.random() * 100. That gives a decimal from 0 up to 100.Math.floorthen makes it a whole number from 0 to 99. So what does+ minimumdo at the end?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.
i write the answer
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.
Lines 14 and 15 are right. Line 13 still starts with "down to". Which function rounds down? Add its name at the start of line 13.