Skip to content

Sheffield | May-2025 | Hassan Osman | Sprint-1 #469

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
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

HassanOHOsman
Copy link

@HassanOHOsman HassanOHOsman commented Jun 2, 2025

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

This pull request includes the coursework for Sprint 1 of the Module: Structuring and Testing Data.

Questions

Ask any questions you have for your reviewer.

@HassanOHOsman HassanOHOsman added Needs Review Participant to add when requesting review 📅 Sprint 1 Assigned during Sprint 1 of this module labels Jun 2, 2025
Comment on lines 9 to 10
Answer: in line 3, the variable count gets reassigned a new value which is the sum of the old value and 1.
In other words, the variable count is now adding 1 to its old value to obtain a new value.
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.

Done!

Comment on lines 13 to 19
2. Math.floor(x) it rounds down x to a value that is less than or equal to x, while Math.random() it generates random
numbers that are equal to 0 and less than 1.
3. before we multiply (Math.random() by (maximum - minimum + 1) or vice versa, each expression gets evaulated
first on its own. Math.random() leads to an integer between 0 and less 1, while (maximum - minimum + 1)) evaluates
to 100. Then multiplication comes into place and we get floats from 0.00 and less than 100. Having Math.floor()
as a method basically means we now have random integers from 0 and 99. By considering the last part of the value
assigned to num, we now have random integers from 1 and 100 (both included).
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. A concise and precise way to describe a range of values is to use interval notation.
    For example, we can say Math.random() returns a random number in the interval [0, 1).

  2. Your description is correct but is a little bit verbose.
    Could you try using ChatGPT to find a clearer, more concise way to describe the code?

Copy link
Author

Choose a reason for hiding this comment

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

Done

Comment on lines 6 to 7
const ClockTime24hour = "08:53";
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Have you also noticed the variable names do not quite match the values assigned to the variable?

  • In JS naming convention, variable names (include identifiers declared using const) usually begins with a lowercase letter. Names starting with an uppercase letter are used for built-in and custom data types (e.g., Math)

Copy link
Author

Choose a reason for hiding this comment

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

Changed this now.


c) line 4 & line 5

d) line 1 & line 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Lines 7 and 8 are also declarations, although they are not really "variables".

Comment on lines 35 to 36
e) The last expression gets rid of all the commas present in the declared variables in line 1 & 2. or in other words, replaces them commas with
no space between the characters separated by the commas.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you ask ChatGPT to describe the code at line 5, and see if you can use something it suggests in your description?

Copy link
Author

Choose a reason for hiding this comment

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

Done!


/*
a) There are 6 in total.
b) 0 function calls.
Copy link
Contributor

Choose a reason for hiding this comment

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

The number of function calls is more than 0.

Comment on lines 34 to 35
f) it works. However, if there's enough time to form a whole hour(s) for example the results shows the total mins and total secs and so
on. So I'd say it works.
Copy link
Contributor

Choose a reason for hiding this comment

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

if there's enough time to form a whole hour(s) for example the results shows the total mins and total secs and so
on.

What do you mean by this statement?

Copy link
Author

Choose a reason for hiding this comment

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

I was basically trying to say that it does work for all movie durations. However, and that depending on the value you may end up with 0 for the hour part and only values for the mins and secs or 0 for both hours and mins and only value for secs for even 0 for all hour, min & sec parts (if movieLength = 0 secs). Anyway, i've rephrased and simplified my response now.

What is the return value of `prompt`?
//undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: To view the return value of a function call, you need to output the return value to the console as console.log( function_call(...) ).

You can also find out exactly what the function returns from the MDN Web Docs website.


Answer the following questions:

What does `console` store?
//console doesn't store. it displays.
Copy link
Contributor

Choose a reason for hiding this comment

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

The question is asking what kind of properties are stored in the console object.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Jun 14, 2025
@HassanOHOsman HassanOHOsman removed the Reviewed Volunteer to add when completing a review label Jun 20, 2025
@HassanOHOsman HassanOHOsman added the Needs Review Participant to add when requesting review label Jun 20, 2025
@@ -19,4 +19,4 @@ Now try invoking the function `prompt` with a string input of `"What is your nam
What effect does calling the `prompt` function have?
//prompt expect input from the user by showing a small window with space for input to be submitted once called.
What is the return value of `prompt`?
//undefined
//a string - the name entered my the user.
Copy link
Contributor

Choose a reason for hiding this comment

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

If you were writing a program that uses prompt() to ask for an input value, how can
your program tell if the user clicked "OK" or "Cancel"?

Copy link
Author

Choose a reason for hiding this comment

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

when clicking ok it displays a string if the user entered a value otherwise, it leads to an empty string. when clicking cancel it displays null.

Copy link
Contributor

Choose a reason for hiding this comment

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

Both console.log("null") and console.log(null) can result in null appearing in the console.
Instead of focusing on the console output, it's clearer to explain what prompt() actually returns.

Copy link
Author

Choose a reason for hiding this comment

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

To be honest, I don't know how to answer this apart from the fact that when ok clicked the user's input is returned otherwise in cancellation null is returned.

Copy link
Contributor

Choose a reason for hiding this comment

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

The term "display" in your original comment suggested you are referring to the values output by console.log() in the console.

Returns is the standard technical term for what a function "generates". It aligns with programming language terminology.

Your latest description is correct.

when ok is clicked the user's input is returned otherwise in cancellation null is returned

Copy link
Author

Choose a reason for hiding this comment

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

Thanks CJ!

@@ -16,7 +16,7 @@ Try also entering `typeof console`
Answer the following questions:

What does `console` store?
//console doesn't store. it displays.
//it stores different logging, debugging, warning/errors and information properties.
Copy link
Contributor

Choose a reason for hiding this comment

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

What are these logging, debugging, ... properties? Are they numbers, strings, or ....?

Copy link
Author

Choose a reason for hiding this comment

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

They are indeed properties - Pairs of keys and their corresponding values.

Copy link
Contributor

Choose a reason for hiding this comment

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

Saying "console is an object that stores ... properties" is too vague; it doesn't explain what kind of properties they are or what they do. Are they storing numbers, strings, or something else? It would be more helpful to clarify what these properties actually represent. Can you provide more detail about them?

Copy link
Author

Choose a reason for hiding this comment

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

Done. Hopefully, my response is sufficient now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Describing code can be quite challenging at first (even in your native language).
Knowing the proper terminologies is important.
That's why I keep suggesting using ChatGPT to explore alternative ways to describe code. Along the way, you might also pick up some useful programming terminology.

Copy link
Author

Choose a reason for hiding this comment

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

Noted. Really appreciate your feedback :)

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Jun 20, 2025
@HassanOHOsman HassanOHOsman added Needs Review Participant to add when requesting review and removed Reviewed Volunteer to add when completing a review labels Jun 23, 2025
@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Jun 23, 2025
@HassanOHOsman HassanOHOsman added Needs Review Participant to add when requesting review and removed Reviewed Volunteer to add when completing a review labels Jun 24, 2025
@cjyuan cjyuan added Complete Volunteer to add when work is complete and review comments have been addressed and removed Needs Review Participant to add when requesting review labels Jun 24, 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 review comments have been addressed 📅 Sprint 1 Assigned during Sprint 1 of this module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants