generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 195
BIRMINGHAM | ITP-MAY-25|Emin Akturk | MODULE-STRUCTURING #617
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
eminakturk
wants to merge
11
commits into
CodeYourFuture:main
Choose a base branch
from
eminakturk:coursework/sprint-1
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
11 commits
Select commit
Hold shift + click to select a range
84e3bca
First 3 exercises of sprint 1 are completed.
eminakturk 3c9fb3a
Key exercise part is done with this commit
eminakturk c882576
Mandatory errors 0 and 1.js is solved.
eminakturk 8ccf3b2
Mandatory-errors part is finished.
eminakturk d0c0bd7
until time format is finished.
eminakturk 721fe57
finishing touch
eminakturk f2f56be
first answer is increment added answer comment section.
eminakturk 421bdf2
random.js solution part is fixed.
eminakturk f978685
4.js syntax error is fixed.
eminakturk ed5a1b5
identified 5th function calls and fixed the programming term with mor…
eminakturk e57d878
.padEnd is deleted as I've reviewed that It's not necessary to have it.
eminakturk 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
const minimum = 1; | ||
const maximum = 100; | ||
const num = 2; | ||
|
||
const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; | ||
|
||
// In this exercise, you will need to work out what num represents? | ||
// Try breaking down the expression and using documentation to explain what it means | ||
// It will help to think about the order in which expressions are evaluated | ||
// Try logging the value of num and running the program several times to build an idea of what the program is doing | ||
|
||
|
||
|
||
// SOLUTION: | ||
|
||
// In this program, variable num is assigned to a value between 1 and 100. | ||
|
||
// In 5th line, expressions of math.floor and math.random are used to generate a random number between the minimum and maximum numbers that are defined by first const minimum= 1 and second const maximum = 100. | ||
|
||
// Also math.floor is used to round down the random number generated by math random to get to the nearest whole number. |
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,4 @@ | ||
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? | ||
|
||
// We can use a comment to prevent the computer from running these lines. |
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,8 @@ | ||
// 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); | ||
|
||
|
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,6 @@ | ||
// 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}`); | ||
|
||
//Code was correct, I just shifted the const part to the top of the code block. |
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,21 @@ | ||
const cardNumber = 4533787178994213; | ||
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 | ||
|
||
|
||
// Prediction; code wont work because slice is for strings, not numbers. | ||
|
||
// after running the code, I got an error saying "cardNumber.slice is not a function". | ||
|
||
// It's what I predicted. | ||
|
||
// to fix the code I need to convert number to string first, then slice 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,2 +1,12 @@ | ||
const 12HourClockTime = "20:53"; | ||
const 24hourClockTime = "08:53"; | ||
//const 12HourClockTime = "20:53"; | ||
//const 24hourClockTime = "08:53"; | ||
|
||
|
||
// problem is in javascript we cant start a variable name with a number. | ||
|
||
// correct way is: | ||
|
||
const twelveHourClockTime = "20:53"; | ||
const twentyFourHourClockTime = "08:53"; | ||
|
||
console.log(`The time in 12-hour format is ${twelveHourClockTime} and in 24-hour format is ${twentyFourHourClockTime}`); |
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
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.
Could we expect this program to work as intended for any valid
penceString
if we deleted.padEnd(2, "0")
from the code?In other words, do we really need
.padEnd(2, "0")
in this script?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.
You can also just answer the question here.