-
-
Notifications
You must be signed in to change notification settings - Fork 195
Glasgow | ITP May -25 | Pandi Simatupang | Module-Structuring-and-Testing-Data | coursework/sprint-1 #649
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?
Glasgow | ITP May -25 | Pandi Simatupang | Module-Structuring-and-Testing-Data | coursework/sprint-1 #649
Changes from all commits
3c0525b
168186a
72645b8
006df3d
998a7ee
63a8de0
04cb872
55aaa5f
c1d3745
a4496e3
13835fb
4bc0b4b
e678b92
a5cd1c5
1f7f9e2
a8546b9
65e1a8e
100b9fd
95efc71
ce9e5c1
a638efe
5ae319d
f45625e
d8f561b
08290c6
3bb0a7c
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,2 @@ | ||
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,7 @@ | ||
// trying to create an age variable and then reassign the value by 1 | ||
|
||
//create variable age | ||
const age = 33; | ||
|
||
//reassign variable age by 1 (+1) | ||
age = age + 1; | ||
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. You should be aware of the term Hoisting, it would allow us to access variables declared with |
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}`); | ||
|
||
//it's not working because variable cityOfBirth was not defined. | ||
//change the position of -- const cityOfBirth = "Bolton"; -- before the logging will fix the problem |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
const cardNumber = 4533787178994213; | ||
const last4Digits = cardNumber.slice(-4); | ||
const cardNumberStr = cardNumber.toString(); | ||
const last4Digits = cardNumberStr.slice(-4); | ||
|
||
// 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. | ||
console.log(last4Digits); | ||
// Consider: Why does it give this error? Is this what I predicted? If not, what's different? | ||
//can not slice a number, the given card number is integer NOT a List or array | ||
// Then try updating the expression last4Digits is assigned to, in order to get the correct value | ||
//fix by give double quotes to turn the number to sting or make a new variable assign cardNumber.toString() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
const 12HourClockTime = "20:53"; | ||
const 24hourClockTime = "08:53"; | ||
const ClockTime_12Hour = "20:53"; | ||
const ClockTime_24hour = "08:53"; | ||
|
||
//variable name convention issues... | ||
//variable name should not started a number |
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. Looks like you still need to answer this one! |
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. Looks like you still need to answer this one! |
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.
That would not work as we cannot reassign variables declared with
const
. What other ways can you think of that can allows us to do what we want?