-
-
Notifications
You must be signed in to change notification settings - Fork 197
LONDON | MAY2025 | EMILIANO URUENA | SPRINT1 #481
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
8779f0f
7e5508b
d7d36b1
72666bd
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,14 @@ | ||
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 don't want the computer to run these 2 lines - how can we solve this problem? | ||
|
||
/* To avoid that the computer run lines on our code, we use characters to make them comments. | ||
In Javascript we can use '//' for simple lines or '/* comment * /' for paragraphs: | ||
*/ | ||
|
||
//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? | ||
*/ |
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; | ||
let age = 33; | ||
age = age + 1; | ||
// The age variable was declared as const; as a result, it can't be reassigned. | ||
// AS solution the variable was declared using 'let'. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
// 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}`); | ||
|
||
// When the message was tried to be printed the system couldn't access to 'cityOfBirth' | ||
// The declaration of the const cityOfBirth must be done before. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
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? | ||
// Then try updating the expression last4Digits is assigned to, in order to get the correct value | ||
|
||
/* | ||
On the first sight I thought that -4 was not a valid value for the slice function. Then I notice that slice works for strings. | ||
Running Error: "TypeError: cardNumber.slice is not a function" | ||
The message doesn't mention the value for slice must be a string. | ||
to extract a part of a number, it must be treated as a string: String(cardNumber) | ||
*/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
const 12HourClockTime = "20:53"; | ||
const 24hourClockTime = "08:53"; | ||
const hourClockTime12 = "20:53"; | ||
const hourClockTime24 = "08:53"; | ||
|
||
/* | ||
The variables on javascript must be declared starting with a letter. | ||
*/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,13 @@ In the Chrome console, | |
invoke the function `alert` with an input string of `"Hello world!"`; | ||
|
||
What effect does calling the `alert` function have? | ||
Calling the alert() function causes a pop-up dialog box which appear in the browser | ||
displaying the message "Hello world!" and an OK button. | ||
|
||
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? | ||
Invoking the 'prompt' function causes an input pup-up dialog in the web browser displaying the message 'What is your name?' and waiting for information from the user. | ||
|
||
What is the return value of `prompt`? | ||
The return value that was provided by the user. | ||
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. If the user entered some value and then clicked "Cancel", does 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, prompt() does not return the user's input if click "Cancel" 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 does it returns if the user clicked "Cancel"? |
Uh oh!
There was an error while loading. Please reload this page.