-
-
Notifications
You must be signed in to change notification settings - Fork 546
Manchester | 26-ITP-Sep | Aklilu Mihtsun | Sprint 2 | Complete Sprint 2 Coursework #1578
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
AkliluMihtsun
wants to merge
22
commits into
CodeYourFuture:main
Choose a base branch
from
AkliluMihtsun: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
22 commits
Select commit
Hold shift + click to select a range
4c29df2
Fix HTML doctype casing and add CSS styles for form layout
AkliluMihtsun 57d7614
Adding comments on line 3
AkliluMihtsun 4804923
added the code to produce the string
AkliluMihtsun 4c1a754
adding values to the var dir & var ext
AkliluMihtsun bc9011c
explanation added on the expression
AkliluMihtsun 8f0d2a6
putting the instruction in comment
AkliluMihtsun d9ef102
fixing the error by changing the declaration keyword
AkliluMihtsun 1915855
fixing the error by declaring and initializing the var before accessi…
AkliluMihtsun 0821e2b
updating var cardNumber into String so that the slice method can work
AkliluMihtsun c5ba16a
removing the starting digit that caused error from the variable name
AkliluMihtsun 8f7878f
adding answers and explanations and fixing the error to the given code
AkliluMihtsun a469ac4
explaining the code
AkliluMihtsun da54930
detailed explanation about the code
AkliluMihtsun c1a241b
correct typos and explain alert and prompt in Chrome console
AkliluMihtsun 9ff581f
add explanations for console methods and dot operator usage
AkliluMihtsun 5bbf762
Remove unrelated form controls changes
AkliluMihtsun 48bc232
Fix ext extraction to use lastDotIndex for accurate file extension
AkliluMihtsun e589aee
Refine comments for clarity and accuracy in random number generation …
AkliluMihtsun 69134dc
Fix typo in random number generation explanation and enhance comments…
AkliluMihtsun 6c0dd00
Add explanation for Number conversion of carPrice string to enhance c…
AkliluMihtsun e11351d
Clarify explanation of totalMinutes calculation in time format conver…
AkliluMihtsun 8926551
Add clarification on argument listing and purpose of "," at end
AkliluMihtsun 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,2 +1,9 @@ | ||
| 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? | ||
|
|
||
| //OR | ||
|
|
||
| /* 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? */ | ||
|
|
||
| // We can put the 2 lines in comment by adding // before each single line or we can enclose them in /* */ if we want to comment multi-line |
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,12 @@ | ||
| // trying to create an age variable and then reassign the value by 1 | ||
|
|
||
| const age = 33; | ||
| //const age = 33; | ||
| let age = 33; | ||
| age = age + 1; | ||
| console.log(age); | ||
|
|
||
| /* When we try to run the code it is giving us an error message saying TypeError: Assignment to constant variable, | ||
| this error is telling us that we are trying to perform an operation on a value that is not the correct type, | ||
| in our case reassigning a cons variable. The cons keyword prevents us from reassigning a variable | ||
| We can overcome the error by changing the declaration keyword to "let" | ||
| */ |
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,5 +1,11 @@ | ||
| // Currently trying to print the string "I was born in Bolton" but it isn't working... | ||
| // what's the error ? | ||
|
|
||
| console.log(`I was born in ${cityOfBirth}`); | ||
| const cityOfBirth = "Bolton"; | ||
| console.log(`I was born in ${cityOfBirth}`); | ||
| //const cityOfBirth = "Bolton"; | ||
|
|
||
| /* When we try to run our code it is giving us an error saying ReferenceError: Cannot access 'cityOfBirth' before initialization | ||
| and this is because we tried to access the var cityOfBirth before we declared and initialized it*/ | ||
|
|
||
| // We can overcome this error by declaring and initializing the var cityOfBirth before accessing it |
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,16 @@ | ||
| const cardNumber = 4533787178994213; | ||
| const last4Digits = cardNumber.slice(-4); | ||
| //const last4Digits = cardNumber.slice(-4); | ||
| const last4Digits = cardNumber.toString().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? | ||
| // Then try updating the expression last4Digits is assigned to, in order to get the correct value | ||
|
|
||
| // I am predicting the code wont't work because the slice method does not work for numbers I guess | ||
| // when i run the program it is giving an error saying "TypeError: cardNumber.slice is not a function" | ||
| // It is giving this error because our var cardNumber is number and numbers don't have slice() method & it is what I predicted | ||
| // In order our code to be able to run we need first to change the number type into String so that the slice() method can function |
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,13 @@ | ||
| const 12HourClockTime = "8:53pm"; | ||
| const 24hourClockTime = "20:53"; | ||
| //const 12HourClockTime = "8:53pm"; | ||
| //const 24hourClockTime = "20:53"; | ||
|
|
||
| const HourClockTime12 = "8:53pm"; | ||
| const hourClockTime24 = "20:53"; | ||
|
|
||
| console.log(HourClockTime12); | ||
| console.log(hourClockTime24); | ||
|
|
||
| // when we tried to run the code it threw an error saying "SyntaxError: Invalid or unexpected token" | ||
| // this happened because when we were declaring a variable we gave an invalid name to the identifier which started with number | ||
| // variable name must start with letters or _ or $ | ||
| // we can fix it buy removing the front number of the identifiers and may be put them last |
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,15 +1,20 @@ | ||
| Open a new window in Chrome, right click an empty space on the page, select **Inspect** from the dropdown, then locate the **Console** tab. | ||
| Open a new window in Chrome, right click page, select **Inspect** from the dropdown, then locate the **Console** tab. | ||
|
|
||
| Voila! You now have access to the [Chrome V8 Engine](https://www.cloudflare.com/en-gb/learning/serverless/glossary/what-is-chrome-v8/). | ||
| Just like the Node REPL, you can input JavaScript code into the Console tab and the V8 engine will execute it. | ||
|
|
||
| Let's try an example. | ||
|
|
||
| In the Chrome console, invoke the function `alert` with one argument, the string `"Hello world!"`; | ||
| Click an empty space on tn the Chrome console, invoke the function `alert` with one argument, the string `"Hello world!"`; | ||
|
|
||
| What effect does calling the `alert` function have? | ||
|
|
||
| // The `alert` function displays a message to the user and it stops js execution until the user dismisses the alert | ||
|
|
||
| Now try invoking the function `prompt` with a string input of `"What is your name?"` - store the return value of your call to `prompt` in an variable called `myName`. | ||
|
|
||
| What effect does calling the `prompt` function have? | ||
| What is the return value of `prompt`? | ||
|
|
||
| // The `prompt` function opens a popup dialog and waits an input from a user. it stops js execution until the user inputs or cancel the popup dialog | ||
| // The return value of `prompt` is a string |
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.
Uh oh!
There was an error while loading. Please reload this page.