-
-
Notifications
You must be signed in to change notification settings - Fork 195
LONDON | ITP_MAY | Mirabel Adom | Module-Structuring-and-Testing-Data | Sprint-1 #619
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?
LONDON | ITP_MAY | Mirabel Adom | Module-Structuring-and-Testing-Data | Sprint-1 #619
Conversation
//In line 3, the assignment operator, '=' assigns the value 'count + 1' to the variable: 'count'. | ||
|
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.
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?
* - Returns a pseudo-random floating-point number between 0 (inclusive) and 1 (exclusive). | ||
* - E.g., 0.000... to 0.999... |
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)
"
//Answer: | ||
//There was an error in line 5 because a comma was missing. | ||
// Instead of the original example in line, which was: replaceAll(", " "")). I inserted a comma in order to fix the code: replaceAll(", ", "")); |
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.
A comma is missing between "," and "" in the function call.
Can you find out the programming term for "," and "" so that we can more accurately describe
"a comma is missing between the ___________."
//5. const pence = paddedPenceNumberString .substring(paddedPenceNumberString.length - 2) .padEnd(2, "0"); | ||
// This gets the last two digits from the string to show the pence. | ||
// If the result is only one digit, it adds a zero at the end to make it two digits. | ||
// In this case, "399" gives us "99", so nothing additional is added. |
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.
Could we expect this program to work as intended for any valid penceString
if we deleted .padEnd(2, "0")
from the code?
In other words, do we really need .padEnd(2, "0")
in this script?
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
In this project, I’ve used JavaScript to explore foundational concepts such as values and variables. I’ve also tackled various challenges, including fixing errors in code, interpreting expressions and operators, and using tools like Chrome DevTools to practice working with the console.
Questions
Ask any questions you have for your reviewer.