Skip to content

Conversation

@anosidium
Copy link

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

I answered all the questions in the .js and .md files

Questions

According to the console in the Web Inspector (Safari) or JavaScript Console (Chrome), Number and String and other types are "function" which confuses me because I expected them to be classified as Object.

In Swift programming language, String, Int, Double, etc. are struct type and not function.

Why are functions that belong to an Object are called function? Why not called method? That's how it is in Swift. Functions are freestanding and belong to no objects, struct, etc.

@anosidium anosidium added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 21, 2025
Copy link
Contributor

@cjyuan cjyuan left a 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?


// 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.
Copy link
Contributor

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
Copy link
Contributor

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?


What is the return value of `prompt`?

The string returned from the textfield what the user has entered otherwise null.
Copy link
Contributor

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?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 25, 2025
@anosidium anosidium added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 28, 2025
@anosidium
Copy link
Author

Regarding the question you asked in the PR description, have you tried asking an AI?

Nope.

Copy link
Contributor

@cjyuan cjyuan left a 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.

// 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]
Copy link
Contributor

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
Copy link
Contributor

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.

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.
Copy link
Contributor

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?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 28, 2025
@anosidium
Copy link
Author

Regarding the question you asked in the PR description, have you tried asking an AI?

Nope.

You should. I strongly encourage AI-assisted learning.

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.

@anosidium anosidium added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 28, 2025
Copy link
Contributor

@cjyuan cjyuan left a 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.

Comment on lines +29 to +31
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.
Copy link
Contributor

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.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants