Skip to content

Conversation

sarawone
Copy link

I have followed the points as per read me file and put the answer in each file.
Please kindly review and let me know the requirements.
Thanks for your time & support ..

@sarawone sarawone self-assigned this Feb 21, 2025
@sarawone sarawone added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 21, 2025
@illicitonion illicitonion added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 5, 2025
Copy link
Member

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

You have both sprint 1 and sprint 2's work in here - please move sprint 2's to another pull request and get it reviewed separately, I have only reviewed sprint 1's here.

In general things are looking decent here, but I'd encourage you to think about the meaning in the problem domain of the code, not just in JavaScript. If we're dealing with time, or money, what do values/operations represent thinking about time/money, not just strings/variables.

const ext = ;
const dir = filePath.slice(0,lastSlashIndex+1);
console.log (`The dir part of the file path ${dir}`);
const ext = filePath.slice(-3);
Copy link
Member

Choose a reason for hiding this comment

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

This works, but it is not very general. If the filePath variable contained a file named hello.jpeg, I don't think it would return the correct result. Can you think how to solve this which would work regardless of the number of characters in the extension?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the feedback .
I fixed the filePath for general purposes. Please check and provide feedback.

Copy link
Member

Choose a reason for hiding this comment

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

Looks great, much more general - thanks!

What do you think would happen if the filename didn't contain any .s? What do you think should happen in that case?

Copy link
Author

Choose a reason for hiding this comment

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

It will return the whole file part .
LastIndexof (".") will return -1 if there are no "." in the file path.
So the slice method will cut the string from the start .

Copy link
Member

Choose a reason for hiding this comment

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

Do you think this is a good answer to the question "What is the extension of this file"? Or is there some better answer we could give?

Copy link
Author

Choose a reason for hiding this comment

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

It will return the whole file path . I think it should raise an error message ("incorrect file format ").

const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;


const step1 = Math.random(); // get random number >=0 & <1
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a good explanation, breaking it down into steps is really useful, but can you also talk about what the whole thing does, as well as just the separate steps?

Copy link
Author

Choose a reason for hiding this comment

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

As a whole thing this program is for testing Operator precedence , in order to know which operation performs fast . I answered as per I understand :)
Please guide me if I am in the wrong way .. Thank you .

Copy link
Member

Choose a reason for hiding this comment

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

Precedence is one of the things being tested here, but general code understanding is too :) Can you try to also describe this code in terms of the problem?

e.g. in the initials exercise you could describe in problem terms we're "Making a string of the first letter of each name" (whereas in programming terms we'd maybe say "We're making variables storing the first character of each name, and then concatenating them together into one variable")

Copy link
Author

Choose a reason for hiding this comment

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

We are making a variable storing the result of round down to nearest largest number of the random numbers multiplied by the result of maximum number subtract minimum , after that adding by 1 and then adding with minimum value.

// 1. const penceString = "399p": initialises a string variable with the value "399p"
// 2. const penceStringWithoutTrailingP = penceString.substring(0,penceString.length - 1) : removing p by using substring method.
// 3.const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); : adding 0 to the start from the left side in case of penstring have 2 numbers only
// 4. const pounds = paddedPenceNumberString.substring(0,paddedPenceNumberString.length - 2); : getting the first letter from the string
Copy link
Member

Choose a reason for hiding this comment

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

The first letter? What's in the string? Why would we be getting the first letter from it?

Copy link
Author

Choose a reason for hiding this comment

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

Getting the first character from the string to get the pound value from the given string penny .

pop up dialog box with text box to accept user input

What is the return value of `prompt`?
string is the return value of prompt
Copy link
Member

Choose a reason for hiding this comment

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

What is returned if the user presses cancel?

Copy link
Author

Choose a reason for hiding this comment

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

null value if user press cancel or enter without typing any value in text box.

Answer the following questions:

What does `console` store?
store data for a while
Copy link
Member

Choose a reason for hiding this comment

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

What do you mean by "a while"? Where does it store data?

Copy link
Author

Choose a reason for hiding this comment

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

It stores data temporarily on the browser's memory when it is open and disappear when refreshing the browser .

@illicitonion illicitonion added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Mar 5, 2025
@sarawone
Copy link
Author

sarawone commented Mar 7, 2025

You have both sprint 1 and sprint 2's work in here - please move sprint 2's to another pull request and get it reviewed separately, I have only reviewed sprint 1's here.

In general things are looking decent here, but I'd encourage you to think about the meaning in the problem domain of the code, not just in JavaScript. If we're dealing with time, or money, what do values/operations represent thinking about time/money, not just strings/variables.

Thanks for the comments.
I already did another PR for sprint 2 .

I did not get your point in the second part. Could you please explain to me again for those ? Thank you so much .

@illicitonion
Copy link
Member

You have both sprint 1 and sprint 2's work in here - please move sprint 2's to another pull request and get it reviewed separately, I have only reviewed sprint 1's here.
In general things are looking decent here, but I'd encourage you to think about the meaning in the problem domain of the code, not just in JavaScript. If we're dealing with time, or money, what do values/operations represent thinking about time/money, not just strings/variables.

Thanks for the comments.
I already did another PR for sprint 2 .

I did not get your point in the second part. Could you please explain to me again for those ? Thank you so much .

Let's take a look at an example from 3-to-pounds:

You wrote: "removing p by using substring method."

This is correct. But what does that mean? It gives us a string containing the number of pence, which we can then convert to a number if we want.

That meaning - that removing the p gives us the number of pence, is really useful to think about. Thinking not just about what we're doing in terms of code, but in terms of the problem. The language of javascript is all about strings and numbers. The language of this problem is about numbers of pence and pounds.

Similarly: "get the last two letter and add zero in case if there is only one letter."

Again, this is true, but in problem terms we're getting the number of pence after taking away all of the whole pounds.

In the future, try to answer questions in both terms - what are we doing in code, and what are we doing in the problem :)

Copy link
Member

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

Some good improvements, well done!

let initials = ``;
// declaring variables for each name and take out fist character

let fname_initials = `${firstName.charAt(0)}`;
Copy link
Member

Choose a reason for hiding this comment

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

In JavaScript we tend to use camelCase not snake_case for variable names, so this would be fnameInitials rather than fname_initials. This isn't a big deal - the code works either way, but it's a convention we tend to stick to.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the advice .
I have changed all the variable names as camelCase.

let initials = ``;
// declaring variables for each name and take out fist character

let fname_initials = `${firstName.charAt(0)}`;
Copy link
Member

Choose a reason for hiding this comment

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

Because charAt returns a string, we don't need to interpolate this into a string as well

Suggested change
let fname_initials = `${firstName.charAt(0)}`;
let fname_initials = firstName.charAt(0);

Copy link
Author

Choose a reason for hiding this comment

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

Remove string interpolate.

let initials = ``;
// declaring variables for each name and take out fist character

let fname_initials = `${firstName.charAt(0)}`;
Copy link
Member

Choose a reason for hiding this comment

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

This string will contain exactly one character, so initial is probably a better than than initials, which suggests it contains more than one :)

Copy link
Author

Choose a reason for hiding this comment

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

noted and changed as per suggestion . Thank you.

const ext = ;
const dir = filePath.slice(0,lastSlashIndex+1);
console.log (`The dir part of the file path ${dir}`);
const ext = filePath.slice(-3);
Copy link
Member

Choose a reason for hiding this comment

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

Looks great, much more general - thanks!

What do you think would happen if the filename didn't contain any .s? What do you think should happen in that case?

Copy link
Member

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

Good improvements!

const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;


const step1 = Math.random(); // get random number >=0 & <1
Copy link
Member

Choose a reason for hiding this comment

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

Precedence is one of the things being tested here, but general code understanding is too :) Can you try to also describe this code in terms of the problem?

e.g. in the initials exercise you could describe in problem terms we're "Making a string of the first letter of each name" (whereas in programming terms we'd maybe say "We're making variables storing the first character of each name, and then concatenating them together into one variable")

const ext = ;
const dir = filePath.slice(0,lastSlashIndex+1);
console.log (`The dir part of the file path ${dir}`);
const ext = filePath.slice(-3);
Copy link
Member

Choose a reason for hiding this comment

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

Do you think this is a good answer to the question "What is the extension of this file"? Or is there some better answer we could give?

// 5
// b) How many function calls are there?

//no function calls
Copy link
Member

Choose a reason for hiding this comment

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

There are also functions that the user didn't define, but that already exist in the language.

A function call generally looks like a pair of ()s after a name (possibly with some values between the ()s).

Do you see any places in this code where there's a name, and then a (, then maybe some values, then a )?

This would still be a function call, even if the user didn't define the function themselves.

@sarawone
Copy link
Author

Checked the feedback and updated/modified the requirements . Ready for review and provide feedback . Thank you

@sarawone sarawone added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 13, 2025
@sarawone
Copy link
Author

Could I change the status to Complete .? :)

}

const currentOutput = formatAs12HourClock("08:00");
const currentOutput = formatAs12HourClock("08:30");
Copy link
Member

Choose a reason for hiding this comment

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

You've correctly identified an issue here, and written a good test for it, but the test is currently failing. Can you fix the code so the test passes?

Copy link
Author

Choose a reason for hiding this comment

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

This change need to submit on Sprint-2 ..Shall I update on spring-2 ?

Copy link
Member

Choose a reason for hiding this comment

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

Aah good call, sorry I didn't realise there were still two sprints of work in here (this is one of the reasons it can be useful to remove the incorrectly added work from one branch when you put it in another :))

Copy link
Author

Choose a reason for hiding this comment

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

Thank for your guidance and feedback .I will update to Sprint-2 by fixing the code . :)
Thank you so much .

@illicitonion illicitonion removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 18, 2025
@illicitonion
Copy link
Member

Nearly! I left two last comments! Thanks for putting in the work to see this through!

@illicitonion illicitonion added the Complete Volunteer to add when work is complete and all review comments have been addressed. label Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants