-
-
Notifications
You must be signed in to change notification settings - Fork 387
London | 26-ITP-May | Russom Gebremeskel | Sprint 1 | Coursework #1384
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
base: main
Are you sure you want to change the base?
Changes from all commits
f2c62af
3bfc796
482d8ee
57dcff5
6f1ae81
b9db880
1029802
78c1956
33a29e1
56fa843
9a730bc
dc16f8d
948d792
1bc9f0c
e24a1d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,5 @@ | ||
| 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? | ||
| */ | ||
|
|
||
| // We can use forward slash and asterisk for multi-line or block comments as used above line 1 to 3. Or we can use double forward slashes for single line comments as used on this 5. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| // trying to create an age variable and then reassign the value by 1 | ||
|
|
||
| const age = 33; | ||
| age = age + 1; | ||
| //age = age + 1; The variable age is declared as a constant using the const keyword, which means its value cannot be changed after it is assigned. | ||
| const newAge = age + 1; // A new variable called newAge is assigned.This way, we can still calculate the new age without modifying the original constant variable. | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,6 @@ | ||
| const 12HourClockTime = "8:53pm"; | ||
| const 24hourClockTime = "20:53"; | ||
|
|
||
| // In js variable names cannot start with a number. The variable names are changed to start with a letter instead of a number as below. | ||
| const twelveHourClockTime = "8:53pm"; | ||
| const twentyFourHourClockTime = "20:53"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,10 +9,16 @@ Let's try an example. | |
|
|
||
| In the Chrome console, | ||
| invoke the function `alert` with an input string of `"Hello world!"`; | ||
|
|
||
| What effect does calling the `alert` function have? | ||
|
|
||
| - A window pops up with `"Hello world!"` message | ||
|
|
||
| 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? | ||
|
|
||
| - a new window popup saying what is your name with a text input field for user to type. | ||
|
|
||
| What is the return value of `prompt`? | ||
|
|
||
| - A text string that input by the user is returned. | ||
|
Comment on lines
22
to
+24
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. What if the user clicked "Cancel" instead of "OK"?
Author
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. I run the code again and if "Cancel " clicked "null" is returned.
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. Is the "null" you mentioned a string?
Author
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. No. Because the user didn't type or input anything
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.
|
||
Uh oh!
There was an error while loading. Please reload this page.