Skip to content

Barcelona | MCB-OCT2025-1 | Jannah Pitogo | Sprint1 | Module-Structuring-and-Testing-Data - #1

Open
jannahpitogo wants to merge 16 commits into
mainfrom
coursework/sprint1
Open

Barcelona | MCB-OCT2025-1 | Jannah Pitogo | Sprint1 | Module-Structuring-and-Testing-Data#1
jannahpitogo wants to merge 16 commits into
mainfrom
coursework/sprint1

Conversation

@jannahpitogo

Copy link
Copy Markdown
Owner

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 | FirstName LastName | Sprint | Assignment Title
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

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.


const dir = ;
const ext = ;
const dir = filePath.slice(0,-8);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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. */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

it's correct, the replaceAll removes the comma
but there's also another thing happening: the Number() -> converts carPrice value from string to number ;)

@rodrigocastromartinez

Copy link
Copy Markdown

@jannahpitogo please check comments and do the fixes in order to approve pr and merge thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants