Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

Northwest Class 4 - Humail Khan - JavaScript-Core-1 - Coursework - Week 1 - #115

Closed
humailhasankhan wants to merge 19 commits into
CodeYourFuture:masterfrom
humailhasankhan:master
Closed

Northwest Class 4 - Humail Khan - JavaScript-Core-1 - Coursework - Week 1#115
humailhasankhan wants to merge 19 commits into
CodeYourFuture:masterfrom
humailhasankhan:master

Conversation

@humailhasankhan

Copy link
Copy Markdown

Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in HOW_TO_MARK.md in the root of this repository

Your Details

  • Your Name:
  • Your City:
  • Your Slack Name:

Homework Details

  • Module:
  • Week:

Notes

  • What did you find easy?

  • What did you find hard?

  • What do you still not understand?

  • Any other notes?

…nother variable with its typeof and logging both variables to the console
…ird variable and logged the third variable to the console
…st one and .trim for the second one to use the given variable and count the characters.
…of students and mentors. Finally, created a third variable with template litterals to give a string including the totals
…ages of students and mentors. Logged it to console using Math.round inside of template literals
…nside of the functions to halve and triple the numbers respectively.
…tion 3 where three parameters are concatenated using the + operator.
…on calling first function to give total and returning value in pounds with toFixed at 2 decimals
…ound *1.4, second function used parseFloat to return decimal number value with toFixed at 2 decimals and calculated 99% of total by multiplying by 0.99
…ring badCode variable and two more variables to go along goodCode variable. Added parseFloat toFixed at 1 decimal so it meets the requirements to cater decimal numbers with 1 decimal
…ber for shakeball function and using else if statements for both functions as conditions to pass the tests
const numberOfMentors = 8;
const totalNumbers = numberOfStudents + numberOfMentors;

console.log(`Number of students: ${numberOfStudents}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nice use of string template

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.

Thank you.

Comment thread extra/2-piping.js

// Why can this code be seen as bad practice? Comment your answer.
let badCode =
let badCode = format(multiply(add(startingValue, 10), 2));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can you articulate why this code would be bad practice?

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.

My take on this one was that chaining too many times would be considered as bad practice.

Comment thread extra/3-magic-8-ball.js
Comment on lines +105 to +113

if (veryPositive.includes(answer)) {
return "very positive";
} else if (positive.includes(answer)) {
return "positive";
} else if (negative.includes(answer)) {
return "negative";
} else if (veryNegative.includes(answer)) {
return "very negative";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nice - this is a good use case for the array method "includes"

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.

Thank you Paul. This was refactored with the help of Guardians.

// Write the body of this function to concatenate three words together.
// Look at the test case below to understand what this function is expected to return.
// We could not use concat() because it only accepts strings. It would not meet all conditions of the test.
return firstWord + " " + secondWord + " " + thirdWord;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How would you explain what happens in this function in order for the last test case to work with a number?

Google "javascript coercion" if you'd like to find out more! We'll see more examples of this throughout the course.

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 would have to look it up. But my guess is that it has to do something with adding numbers and strings together. 13 is a number in the last test and the rest are strings. Probably the typeof would be different and they would be added together but not computed? I will look into javascript coercion. Thanks Paul.

@peedeerich

Copy link
Copy Markdown

Excellent work - well done! You have also used some array methods I see - you'll be seeing more of those in JS 3 so stay tuned :)

@github-actions

Copy link
Copy Markdown

Your coursework submission has been closed because nobody has interacted with it in six weeks. You are welcome to re-open it to get more feedback.

@github-actions github-actions Bot added the Stale label Aug 21, 2021
@github-actions github-actions Bot closed this Aug 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants