Skip to content

26-itp-1 | Benjamin Vanderzeypen | Sprint-1#56

Closed
nuttyproducer wants to merge 9 commits intoHackYourFutureBelgium:mainfrom
nuttyproducer:coursework/sprint-1
Closed

26-itp-1 | Benjamin Vanderzeypen | Sprint-1#56
nuttyproducer wants to merge 9 commits intoHackYourFutureBelgium:mainfrom
nuttyproducer:coursework/sprint-1

Conversation

@nuttyproducer
Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

I've updated all the exercises in Sprint-1 on the branch /coursework/sprint-1

Questions

I have created a bunch of other exercises in the prep folder. Is anyone interested in seeing them?
I create a second PR with only the extra prep material.

Add totalDays to our logic.
Also added some extra features that i'm learning on the side. I want to see Dashes between the every 4 numbers.
Copy link
Copy Markdown
Collaborator

@robertopaixao robertopaixao left a comment

Choose a reason for hiding this comment

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

You exercice looks great, just some tips and few comments for check.

let count = 0;

count = count + 1;
count = count + 1; // = assigns a new number to count = 0 -> 1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, and as a tip, if you want to increment an existing variable, you can also rely on the ++ operator.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Increment

const remainingHours = totalHours % 24; // leftover hours after counting full days
const totalDays = (totalHours - remainingHours) / 24; // total full days

if (totalHours >= 24) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Your condition is showing the days when there are no days and not showing when it should show.
So, there is an error here in the structure.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have changed the condition to if (totalHours < 24). This will switch both our console.logs.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

great

@@ -1,25 +1,41 @@
const movieLength = 8784; // length of movie in seconds
const movieLength = 2603; // length of movie in seconds
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Try to use a movie length of 3661, and you will see something not fully correct in the output of your program.
Let me know if you cannot identify it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ohhh I see @robertopaixao It will give you an output of 1:1:1.
So what we need to do is again call method .toString() + .padStart(2, "0")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

great man

maskedWithDashes += masked.slice(i, i + 4); // Add the next group of 4 characters
}

console.log(maskedWithDashes); // Output: ****-****-****-4213
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice that you use the pad here. You are assimilating things fast.

Also totalhours should be remaining hours in console.log of else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants