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

Glasgow_Class|Shreef_Ibrahim|Structuring _Testing _Datast|Week1_exercise1-update #234

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

Conversation

shreefAhmedM
Copy link

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 COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@shreefAhmedM shreefAhmedM added the Needs Review Participant to add when requesting review label Dec 21, 2024
@shreefAhmedM shreefAhmedM changed the title Glasgow_Class|Shreef_Ibrahim|Structuring _Testing _Datast|Week1_exercise1 Glasgow_Class|Shreef_Ibrahim|Structuring _Testing _Datast|Week1_exercise1-update Dec 21, 2024
@shreefAhmedM shreefAhmedM requested review from cjyuan and SallyMcGrath and removed request for cjyuan December 22, 2024 12:09
@cjyuan
Copy link

cjyuan commented Dec 22, 2024

The current branch contains only one modified file.

You need to copy your modified files from branch sprint_1_exercises to this branch. You can download the files in branch sprint_1_exercises from Github.

When you have updated this branch, you can add a "Need Review" label and tag me.

@cjyuan cjyuan added 👀 Review Requirements Changes requested to meet requirements and removed Needs Review Participant to add when requesting review labels Dec 22, 2024
@shreefAhmedM shreefAhmedM added the Needs Review Participant to add when requesting review label Dec 23, 2024
Copy link

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Code is generally good.
I left some comments and suggestions.

@@ -1,9 +1,14 @@
const cardNumber = 4533787178994213;
const last4Digits = cardNumber.slice(-4);
const last4Digits = cardNumber.slice(4);
Copy link

Choose a reason for hiding this comment

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

Have you tried executing this script to see if it works?

Copy link
Author

Choose a reason for hiding this comment

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

Yes it log error => TypeError: cardNumber.slice is not a function.
I have updated the code by Convert the number to a string using .toString()
and Slice(-4) extract the last 4 characters of the string, starting from the end.
now the output of last4Digits correctly stores "4213"

@@ -1,6 +1,8 @@
let count = 0;

count = count + 1;
count = count++;
Copy link

Choose a reason for hiding this comment

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

Why changed the original code at line 3?
If you want to use ++ operator, you can just write count++ without the assignment operator.

Copy link
Author

Choose a reason for hiding this comment

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

I have updated

@@ -7,3 +7,11 @@ const num = 56.5678;
// 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
var wholeNumberPart = Math.floor(num);
Copy link

Choose a reason for hiding this comment

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

It is better to use 'let' than 'var' to declare variable.

Copy link
Author

Choose a reason for hiding this comment

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

I have updated

@@ -4,3 +4,5 @@ let lastName = "Johnson";

// 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.
var initials =
firstName.slice(0, 1) + middleName.slice(0, 1) + lastName.slice(0, 1);
Copy link

Choose a reason for hiding this comment

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

There is a simpler syntax to retrieve the first character from a string.

Copy link
Author

Choose a reason for hiding this comment

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

Strings in JavaScript can be treated like arrays of characters, so i have updated using firstName[0] + middleName[0] + lastName[0], now i think more accrued

@@ -16,3 +16,6 @@ console.log(`The base part of ${filePath} is ${base}`);

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

var dir = filePath.slice(0, lastSlashIndex);
var ext = base.slice(4);
Copy link

Choose a reason for hiding this comment

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

How would you change your code so that it can also work for file paths like
/path1/.git/filename.js
/path1/path2/package.json
?

Copy link
Author

Choose a reason for hiding this comment

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

I have updated its dynamic now.
1- /path1/.git/filename.js
2- /path1/path2/package.json
the expected output :
The base part files1 and 2 paths are filename.js , package.json
The dir part of file 1 and 2 paths are /path1/.git, /path1/path2
The ext part of file 1 and 2 paths are .js, .json

Comment on lines +10 to +11
// The variable num represents a random integer between 1 and 100.
// so each time you run the program, a different integer within the range [1, 100] will be generate.
Copy link

Choose a reason for hiding this comment

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

To test your understanding, how would you write an expression
(without using any variable in the expression) that yields a random
integer between -5 and 3 (including -5 and 3)?

Copy link
Author

Choose a reason for hiding this comment

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

Math.floor(Math.random() * (3 + 5 + 1)) - 5;

// c) Using documentation, explain what the expression movieLength % 60 represents
// The remainder (%) operator returns the remainder left over when one operand is divided by a second operand. It always takes the sign of the dividend.fb
Copy link

Choose a reason for hiding this comment

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

What does this particular remainder represent?

Copy link
Author

Choose a reason for hiding this comment

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

Represents the remaining minutes that are not part of a full hour when the movie length is expressed in hours and minutes.


// e) What do you think the variable result represents? Can you think of a better name for this variable?
// its using tamplat to store variable and any tex /the better name could be time
Copy link

Choose a reason for hiding this comment

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

time may also imply value like "8:45 pm" or "20:45". Can you come out with a more suitable name?

Copy link
Author

Choose a reason for hiding this comment

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

i think. movieRuntime

Comment on lines +38 to +39
// this will finsh i 4 steps A/initialises a string variable/B- git the value (paddedPenceNumberString.length - 2 == 1)and take us arg
// C/ calc paddedPenceNumberString.substring(1)=="99" and the resultof padEnd() = 99 asign tp the pence
Copy link

Choose a reason for hiding this comment

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

Can we expect this program to work as intended even if we deleted .padEnd(2, "0") from 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.

yes, it will work because it formatted when added earlier padStart(3, "0").

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed 👀 Review Requirements Changes requested to meet requirements Needs Review Participant to add when requesting review labels Dec 23, 2024
@shreefAhmedM shreefAhmedM added the Complete Participant to add when work is complete and review comments have been addressed label Dec 30, 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 Reviewed Volunteer to add when completing a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants