Barcelona | MCB-OCT2025-1 | Jannah Pitogo | Sprint1 | Module-Structuring-and-Testing-Data - #1
Barcelona | MCB-OCT2025-1 | Jannah Pitogo | Sprint1 | Module-Structuring-and-Testing-Data#1jannahpitogo wants to merge 16 commits into
Conversation
…ion. Added some comments to explain.
…ing the print. Added some comments explaining the error
…ror and satisfy the instructions.
…of the variable names to remove the error.
|
|
||
| const dir = ; | ||
| const ext = ; | ||
| const dir = filePath.slice(0,-8); |
There was a problem hiding this comment.
this will work only for this particular case but as soon as any of the folders or file name changes, it will be obsolete. you need to find a way to make it work no matter the name of the file or the folder. check the first part of the example as a clue and see how it finds the last slash position :)
| > After that it will multiply it to a random float value that is minimum of 0 but will never be greater and be 1. | ||
| > After multiplying both numbers, it will get the whole bigger value from the answer because of Math.floor. | ||
| > After getting the round up value, it will add the initialize value of the minimum variable. | ||
| > This answer to this expression will be stored in the variable num. */ |
There was a problem hiding this comment.
so the general idea is that num will be a random number between maximum and minimum.
Math.random() gives you a random number between 0 and 1
(maximum - minimum + 1) gives the amplitude that it needs to have
Math.floor() just removes decimals
+minimum moves the final number to be at least the minimum value
it's not that easy to understand, if it's not clear just ask me please :)
| //I changed the type const because this means that any variable declared as const, it's value cannot be changed. | ||
| //I put var so that I can reassigned the value age to another value. | ||
|
|
||
| age = 1; |
There was a problem hiding this comment.
I think you only needed to change const to let, so that part is ok!
but "reassign the value by 1" is to +1, so:
age = age + 1
is the correct answer. you just assigned the value exactly TO 1 and seems not to be the idea :)
|
|
||
| // a) How many function calls are there in this file? Write down all the lines where a function call is made | ||
|
|
||
| // There is 1 function called which is the console.log() in line 10. |
There was a problem hiding this comment.
both .replaceAll() are function calls as well :) also each of the Number()
so there are 5 function calls :)
|
|
||
| // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? | ||
|
|
||
| // This replaces the coma to nothing since there is nothing in the replaceValue space in line 5. |
There was a problem hiding this comment.
it's correct, the replaceAll removes the comma
but there's also another thing happening: the Number() -> converts carPrice value from string to number ;)
|
@jannahpitogo please check comments and do the fixes in order to approve pr and merge thanks :) |
Learners, PR Template
Self checklist
I have solved and explain all the necessary problems to be solved which is the Sprint1 folder.
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.