Skip to content

London | Forogh Aghaeiyarijani | Module-Structuring-and-Testing-Data | sprint1| week1 #59

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

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

Conversation

Forogh-Aghaeiyarijani
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.

@Forogh-Aghaeiyarijani Forogh-Aghaeiyarijani added the Needs Review Participant to add when requesting review label Oct 30, 2024
Copy link
Member

@SallyMcGrath SallyMcGrath left a comment

Choose a reason for hiding this comment

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

Hi @Forogh-Aghaeiyarijani . Is there a bit more to do here? It looks like there are many more exercises in the folders.

@@ -1,5 +1,5 @@
// Currently trying to print the string "I was born in Bolton" but it isn't working...
// what's the error ?
Copy link
Member

Choose a reason for hiding this comment

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

Try writing in your explanation as well as fixing the code - we are communicating about code here.

Choose a reason for hiding this comment

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

Hi SallyMcGrath, Thanks for reviewing my code.
Sprint-1/errors/2.js: //Computer reads code from the line by line, so we need to first define variables and then get console.

@@ -1,4 +1,4 @@
const cardNumber = 4533787178994213;
const cardNumber = "4533787178994213";
Copy link
Member

Choose a reason for hiding this comment

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

The exercise asks you to update "the expression last4Digits is assigned to, in order to get the correct value"

Can you try doing this? In your code you have changed the data type to a string. Can you think why or when it might not be a good idea to change a number to a string?

Choose a reason for hiding this comment

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

If cardNumber were a number (not a string), this would raise a TypeError because numbers don't have a slice() method.
If cardNumber were a number, JavaScript would throw a TypeError because slice() is not a method for numbers.
Why String Conversion Might Not Always Be Ideal:
1-Loss of Numerical Context: After converting to a string, performing arithmetic operations requires converting back to a number.
2-Performance Considerations: String manipulation can be less efficient than numerical operations, especially in large-scale data processing.
3-Clarity: Maintaining a variable as a number can make the code easier to understand in contexts where numeric operations are expected. ​​

@SallyMcGrath SallyMcGrath added 👀 Review Requirements Changes requested to meet requirements Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 Review Requirements Changes requested to meet requirements Reviewed Volunteer to add when completing a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants