Skip to content
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

West Midlands|Azar Alampanah| Module-structuring-and-testing-data|week1 #56

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

azaralampanah2
Copy link

Learners, PR Template

Self checklist

  • [yes ] I have committed my files one by one, on purpose, and for a reason
  • [yes ] I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • [ yes] I have tested my changes
  • [yes ] My changes follow the style guide
  • [yes ] My changes meet the requirements of this task

Changelist

Briefly explain your PR:
This PR is about my works on Module structuring and testing data/sprint1/backlog/complete sprint1 exercises

Questions

I have asked a question on sprint1/interprete/to-pounds.js and would be grateful if my question to be answered

@azaralampanah2 azaralampanah2 added the Needs Review Participant to add when requesting review label Oct 29, 2024
@moneyinthesky
Copy link

Hi @azaralampanah2, can you please take a look at the Files changed tab on this PR? It looks like every file in the repo has been updated, which I think was not what you intended 😄
Can you make sure your PR contains only the changes you're intending to make? Thanks!

@moneyinthesky moneyinthesky added the 👀 Review Git Changes requested to do with Git label Nov 2, 2024
// Create a variable called roundedNum and assign to it an expression that evaluates to 57 ( num rounded to the nearest whole number )

// Log your variables to the console to check your answers
const num = 56.5678;

Choose a reason for hiding this comment

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

This is a good attempt 😄 But I think we can review a few concepts here.

Let's pay special attention to the requirements of the exercise: they say "Create a variable called decimalPart", but are we satisfying this requirement here? 🤔 Take a look at other examples of "creating a variable" in the prep work: https://programming.codeyourfuture.io/structuring-data/sprints/1/prep/#variables

// You should look up Math functions for this exercise https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math

// Create a variable called wholeNumberPart and assign to it an expression that evaluates to 56 ( the whole number part of num )
const wholeNumberPart=console.log(`the whole part of number${num} is : ${Math.trunc(num)}`);

Choose a reason for hiding this comment

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

Here, you are declaring a variable called wholeNumberPart and assigning it the value returned by the call to the console.log function.

  • What do you think the value of wholeNumberPart will be after this line? Can you output the value to find out?
  • What happens if you remove this line? How does it affect the rest of the code? 🤔
    Can you try the above, running your code after each change?

Copy link
Author

Choose a reason for hiding this comment

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

Dear @moneyinthesky ,

  • I tried to execute this line with different numbers. This line will return the whole part of the number without rounding the number. I reckon it is doing well, but you mean it doesn't. I would appreciate it if you could give me a clue to resolve the issue.
  • I've used two different methods to show the whole part of a number and have divided them with "//or" at line 7, so if I remove this line nothing will happen, as lines 8-13 will have the same functionality and also the same output.
    Thank you so much again for your precious reviews.

// Declare a variable called initials that stores the first character of each string.
// This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution.

let initial=firstName[0]+middleName[0]+lastName[0];

Choose a reason for hiding this comment

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

Nice work here 😄
How many initials do we have here? It looks like 3, right? But if I look at the variable name initial - it makes me think that there is only 1 initial. How can we change this to make it clear that there is more than one initial?

Copy link
Author

Choose a reason for hiding this comment

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

That's right!
So I changed it to "initials"! Now makes sense!
Thanks.

const base = filePath.slice(lastSlashIndex + 1);
console.log(`The base part of ${filePath} is ${base}`);

// Create a variable to store the dir part of the filePath variable

Choose a reason for hiding this comment

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

When writing code, it's important to think about other software developers who might be reading our code in the future. One way to make our code more readable is to use camel-case variable names. You can read more about what this means here: https://developer.mozilla.org/en-US/docs/Glossary/Camel_case
Can you try changing your variable names to camel case?

Copy link
Author

Choose a reason for hiding this comment

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

Dear @moneyinthesky ,
I have amended variable names to camel_case format.
Thanks

const dirpart=filePath.slice(0,lastSlashIndex);
console.log(`the dir part of ${filePath} is : ${dirpart}`);
// Create a variable to store the ext part of the variable
const lastdotindex=filePath.lastIndexOf(".");

Choose a reason for hiding this comment

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

The exercise is asking us to store the "ext" part of the filePath variable. Are we really storing the "ext" part here? What do you see when you run the code?

Copy link
Author

Choose a reason for hiding this comment

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

sorry @moneyinthesky ,
I misunderstood. Now it's been amended to show "ext" part of the filePath.
Thanks.

//then multiples it by (maximum-minimum+1)
//function Math.floor() gives the nearest integer of the previous line
//num equals the addition of the nearest integer and minimum
//so num is a random integer between minimum and maximum

Choose a reason for hiding this comment

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

Nice explanation 🎉


console.log(`The percentage change is ${percentageChange}`);

// Read the code and then answer the questions below

Choose a reason for hiding this comment

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

Perfect!

//it retains the movielenght in the format of hour:minutes:seconds
//we can use some other names insted of result, such as "movieduration"

// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer

Choose a reason for hiding this comment

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

What happens if the movie length is very small, for example: const movieLength = 33;?
What will the output be? Can it be improved in any way? And if so, can you think about how to improve it?

Copy link
Author

Choose a reason for hiding this comment

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

Dear @moneyinthesky ,
It seems codes are working well for all non-negative, negative, and zero numbers.

@moneyinthesky moneyinthesky added the Reviewed Volunteer to add when completing a review label Nov 2, 2024
@azaralampanah2
Copy link
Author

Hi @azaralampanah2, can you please take a look at the Files changed tab on this PR? It looks like every file in the repo has been updated, which I think was not what you intended 😄 Can you make sure your PR contains only the changes you're intending to make? Thanks!
Hi @moneyinthesky ,
Thank you so much for reviewing my work and for giving feedback for it. I really appreciate it.
I don't really know, why and how all files in the repo has been changed. I also searched for how to fix this issue on my recent work and haven't found any solution for that. Is there any article that I could use and read to fix this issue, please?
I will review and amend my work with considering the points mentioned by you. Do I need to close this PR and raise a new pull request after amending or just change the label to "Complete" would be enough?
Thank you in advance!

@azaralampanah2 azaralampanah2 added Complete Participant to add when work is complete and review comments have been addressed and removed Reviewed Volunteer to add when completing a review 👀 Review Git Changes requested to do with Git Needs Review Participant to add when requesting review labels Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Participant to add when work is complete and review comments have been addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants