Skip to content

Sheffield|May-2025|Sheida Shabankari|Module-Structuring-and-Testing-Data | Sprint-1#504

Closed
sheida-shab wants to merge 18 commits intoCodeYourFuture:mainfrom
sheida-shab:coursework/sprint-1
Closed

Sheffield|May-2025|Sheida Shabankari|Module-Structuring-and-Testing-Data | Sprint-1#504
sheida-shab wants to merge 18 commits intoCodeYourFuture:mainfrom
sheida-shab:coursework/sprint-1

Conversation

@sheida-shab
Copy link

No description provided.

Create sprint-1
Describe what line 3 is doing
Show the first character of each string
the dir and ext part of the filePath variable
logging the value of num
add // to comment the text
change const to let for assigning
change the order of commands
updating the expression last4Digits is assigned to
varriable names must not start whit digits
percentageChange error handling
Testing and interpreting time format
Interpreting codes to-pounds
working with  Chrome console
using objects and methods
updating the answers
@sheida-shab sheida-shab added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 10, 2025
@cjyuan cjyuan added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Jun 19, 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.

Code and explanation are good.

I only have a few suggestions and comments.


// Line 1 is a variable declaration, creating the count variable with an initial value of 0
// Describe what line 3 is doing, in particular focus on what = is doing
Add 1 to the value of count variable and assign new the value to count variable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Operation like count = count + 1 is very common in programming, and there is a programming term describing such operation.

Can you find out what one-word programming term describes the operation on line 3?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we can use count++ instead of count = count + 1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a programming term (a single word) describing operation like count++ or count = count + 1.
What is the English term for this? Using proper terminology can help you communicate more effectively with other programmers.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increment

const num2 = Math.random() * (maximum - minimum + 1)
//third operation: floor() function round a number down to the nearest whole integer
const num3=Math.floor(num2)
//final operation : add the value of minimum var (1) to num3 and num4 is equal to num our result
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your current description is a literal translation of the JS code. Could you explain the purpose of adding minimum to num3?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course ,I keep the result of "Math.floor(Math.random() * (maximum - minimum + 1))" in num3
and the main expression is "num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;" that means I should add minimum to num3 value to get num value.
num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum
"num" is equal to "num4" is equal to "num3 + minimum"

Copy link
Contributor

@cjyuan cjyuan Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant to ask, can you explain the purpose of adding minimum to Math.floor(Math.random() * (maximum - minimum + 1)) in the original expression?

For examples,

  • maximum - minimum + 1 (which evaluates to 100) represents the range of the numbers we want to generate.
  • Math.random() * (maximum - minimum + 1) is to scale the random number from the interval [0, 1) to [0, 100).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of adding minimum is that we eant the result be greater than 1 because the value of minimum variable is 1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we can say, to "shift the range by 1", or "shift the range from [0, 99] to [1, 100]".


// a) How many function calls are there in this file? Write down all the lines where a function call is made

4 times : 2 times function Number() and 2 times function replaceAll() are called.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are more than 4 function calls.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you . There are 5 functions.
Now I know that console.log() is a function too.I think it is a method and it's diffrent with function .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right that method and function are not the same things.

In JavaScript, a method is a function that is associated with a property of an object.

That is why console.log() is also normally considered as a function call.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@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. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jun 19, 2025
@sheida-shab sheida-shab added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 20, 2025
@cjyuan
Copy link
Contributor

cjyuan commented Jun 20, 2025

Your changes look good. I only have few follow-up questions/comments in the previous inline comment threads.

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 20, 2025
@sheida-shab sheida-shab added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 20, 2025
@cjyuan cjyuan removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Jun 21, 2025
@cjyuan cjyuan added the Complete Volunteer to add when work is complete and all review comments have been addressed. label Jun 21, 2025
@cjyuan
Copy link
Contributor

cjyuan commented Jun 21, 2025

Good job.

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.

3 participants