London | 26-ITP-May |Rizqah Popoola| Sprint 1 | Coursework#1436
London | 26-ITP-May |Rizqah Popoola| Sprint 1 | Coursework#1436risikatpopoola wants to merge 3 commits into
Conversation
|
|
||
| // 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 | ||
| // In Line 3, count is a variable, and the = is an assignment operator that stores the result of the operation(Addition) No newline at end of file |
There was a problem hiding this comment.
Operation like count = count + 1 is very common in programming, and there is a programming term describing such operation.
Could you find out what one-word programming term describes the operation on line 3?
| const dir = ; | ||
| const ext = ; | ||
|
|
||
| const dir =filePath.slice(0, filePath.lastIndexOf("/")+1); |
There was a problem hiding this comment.
Should the "dir" part include a trailing slash?
| //The math.Floor method rounds a number to the nearest integer, so using bodmas, | ||
| //the expressions are evaluated, the minimum which equals 1 is added to 1 then subtracted from maximum(100), after which it is multiplied by | ||
| //a random number between 0-1 exclusive and then rounded down to the nearest integer after which the minimum is added. The values produced ranges from 0-100 No newline at end of file |
There was a problem hiding this comment.
The values produced ranges from 0-100
This description is not quite correct.
Could the value of num be 0 or 100?
| const cardNumber = '4533787178994213'; | ||
| const last4Digits = cardNumber.slice(-4); |
There was a problem hiding this comment.
Suppose you were not allowed to modify the statement const cardNumber = 4533787178994213;
(that is, keep the variable's value unchanged).
How would you modify the code (through type conversion) to still being able to use .slice(-4) to extract the last 4 digits from the given number.
| const TwelveHourClockTime = "8:53pm"; | ||
| const TwentyFourHourClockTime = "20:53"; |
There was a problem hiding this comment.
In JS naming convention, variable names usually begins with a lowercase letter. Names starting with an uppercase letter are used for built-in and custom data types (e.g., Math)
|
|
||
| // b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? | ||
|
|
||
| // Line 5, it was missing a comma between the characters that are to be replaced so to fix the problem, include a comma |
There was a problem hiding this comment.
Instead of saying something like, 'a comma is missing between "," and "" in the function call', we could also say: A comma is missing between the ___________s.
What is this programming term that refers to the values passed to a function? It begins with an 'a'.
| //The expression assigned to totalMinutes means that the remaining seconds are subtracted from the movieLength and then divided by 60 to get the total number of minutes in the movie length. | ||
|
|
||
| // e) What do you think the variable result represents? Can you think of a better name for this variable? | ||
| //The variable result represents the total time of the movie, in hours minutes and seconds. A better name for this variable could be totaltime |
There was a problem hiding this comment.
The name totalTime does not quite indicate the value stored in the variable
is a formatted string in the form "2:12:02".
Could you suggest a more descriptive name?
| What is the return value of `prompt`? | ||
| the input entered |
There was a problem hiding this comment.
What if a user enters a name and then click "Cancel" instead of "OK"?
| What does `console` store? The console object provides access to the debugging console. It stores text and data explicitly sent to it using methods like console.log() or console.info() | ||
| What does the syntax `console.log` or `console.assert` mean? | ||
| The assert() method writes a message to the console if an expression evaluates to false. The log() method writes (logs) a message to the console. | ||
| In particular, what does the `.` mean? |
There was a problem hiding this comment.
Could you also describe what . in console.log mean?
Note: The console object does not stores the text or data passed to its methods.
Learners, PR Template
Self checklist
Changelist
This PR is for coursework sprint 1