-
-
Notifications
You must be signed in to change notification settings - Fork 240
London | 25-ITP-September | Ammad Ur Rehman | Sprint 1 | 03 Complete Sprint 1 Coursework #785
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?
Conversation
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.
Regarding the question you asked in the PR description, have you tried asking an AI?
Sprint-1/1-key-exercises/4-random.js
Outdated
|
|
||
| // num represents a random number in an inclusive range from 1 to 100 | ||
| // First, it starts with 100 - 1 + 1, which is equals to 100 | ||
| // Secondly, it multiply with Math.random(), which the function returns any number between 0 and 1, inclusive. |
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.
We can also use the concise and precise interval notation to describe a range of values.
[,]=> inclusion(,)=> exclusion
For example, we can say, "Math.random()returns a random number in the interval[0, 1)"
| // Read the code and then answer the questions below | ||
|
|
||
| // a) How many function calls are there in this file? Write down all the lines where a function call is made | ||
| // Line 4, 5 |
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 missed one.
And what's the total number of function calls?
Sprint-1/4-stretch-explore/chrome.md
Outdated
|
|
||
| What is the return value of `prompt`? | ||
|
|
||
| The string returned from the textfield what the user has entered otherwise null. |
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.
When does the function return null?
Nope. |
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.
Regarding the question you asked in the PR description, have you tried asking an AI?
Nope.
You should. I strongly encourage AI-assisted learning.
Sprint-1/1-key-exercises/4-random.js
Outdated
| // num represents a random number in the interval [1,100] | ||
| // First, it starts with 100 - 1 + 1, which is equals to 100 | ||
| // Secondly, it multiply with Math.random(), which the function returns any number between 0 and 1, inclusive. | ||
| // Secondly, it multiply with Math.random(), which the function returns any number in the interval [0,1] |
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.
How do you figure it is [0, 1] and not [0, 1)?
|
|
||
| // a) How many function calls are there in this file? Write down all the lines where a function call is made | ||
| // Line 4, 5 | ||
| // Line 4, 5, 10 |
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 still does not indicate how many function calls? And the answer is not 3.
Sprint-1/4-stretch-explore/chrome.md
Outdated
| What is the return value of `prompt`? | ||
|
|
||
| The string returned from the textfield what the user has entered otherwise null. | ||
| The string returned from the textfield what the user has entered otherwise null if the user left it blank. |
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.
What does the function return when the user does not enter anything and click the "OK" button? null or an empty string ""?
When does the function return null?
I was under the impression that AI tools should be avoided and that we should instead ask other trainees and volunteers, as well as use Google. |
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.
I was under the impression that AI tools should be avoided and that we should instead ask other trainees and volunteers, as well as use Google.
Not at all. Asking AI is not much different from asking volunteers or using Google search. You just need to validate the answer and make sure you truly understand the answer (to the point that you can reproduce the solution or explain the solution).
AI is here to stay, and knowing how to use it as a tool to find answer and solve problem is a critical skill to flourish in the IT field.
Why don't you try your question (in the PR description) on AI. If you present your answer here, I will share my view with you.
Changes look good. I will mark this as "Complete" first.
| If the user has entered text, the return value is a string containing the entered text. | ||
| If the user leaves the text field blank and clicks the OK button, the return value is an empty string. | ||
| If the user enters a name or leaves the text field blank but clicks the Cancel button, the return value is null. |
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.
This is accurate but could be simplified. Some of the info is not very useful.
Knowing how to explain or describe code is an important skill in software development.
Suggestion: Use AI to help you figure out how to make the description more concise.
Learners, PR Template
Self checklist
Changelist
I answered all the questions in the
.jsand.mdfilesQuestions
According to the console in the Web Inspector (Safari) or JavaScript Console (Chrome),
NumberandStringand other types are "function" which confuses me because I expected them to be classified asObject.In Swift programming language,
String,Int,Double, etc. arestructtype and notfunction.Why are
functions that belong to anObjectare calledfunction? Why not calledmethod? That's how it is in Swift. Functions are freestanding and belong to no objects, struct, etc.