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

London class 8 - Craig D'Silva - JavaScript Core 1 - week 1 - #235

Closed
craig-dsilva wants to merge 5 commits into
CodeYourFuture:masterfrom
craig-dsilva:master
Closed

London class 8 - Craig D'Silva - JavaScript Core 1 - week 1#235
craig-dsilva wants to merge 5 commits into
CodeYourFuture:masterfrom
craig-dsilva:master

Conversation

@craig-dsilva

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: Craig
  • Your City: London
  • Your Slack Name: Craig - Trainee

Homework Details

  • Module: JavaScript Core 1
  • Week: 1

Notes

  • What did you find easy?
    The exercises were easy to understand

  • What did you find hard?
    The magic 8 ball

  • What do you still not understand?
    I didn't understand what to do for magic 8 ball

  • Any other notes?

Comment thread extra/2-piping.js

const startingValue = 2;

// Why can this code be seen as bad practice? Comment your answer.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Still need to answer this question (with a comment)

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.

Sorry, I forgot about this.

Comment thread extra/2-piping.js Outdated

let sum = add(startingValue, 10);
let product = multiply(sum, 2);
let formatted = `£${product}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is this going to always produce the correct two decimal places?

@craig-dsilva craig-dsilva Dec 17, 2021

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.

No, but now I have added Math.round() to product because the tests provided fails with a decimal value.

Comment thread mandatory/4-tax.js Outdated

function calculateSalesTax() {}
function calculateSalesTax(amount) {
return (amount * 20) / 100 + amount;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this doesn't seem quite right. This function should just calculate the sales tax (not add the sales tax).

return amount * 0.2

Comment thread mandatory/4-tax.js

function addTaxAndFormatCurrency() {}
function addTaxAndFormatCurrency(amount) {
return `£${calculateSalesTax(amount).toFixed(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.

this is where we add the sales tax

function addTaxAndFormatCurrency(amount) {
  const tax = calculateSalesTax(amount)
  const total = amount + tax
  // etc
}

Fixed some code after reviewing from the solutions
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants