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

NW5-Manchester-Mustafa Acar-JavaScript-Core-1-Coursework-Week1#379

Open
MustafaAcar-sys wants to merge 2 commits intoCodeYourFuture:masterfrom
MustafaAcar-sys:master
Open

NW5-Manchester-Mustafa Acar-JavaScript-Core-1-Coursework-Week1#379
MustafaAcar-sys wants to merge 2 commits intoCodeYourFuture:masterfrom
MustafaAcar-sys:master

Conversation

@MustafaAcar-sys
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: Mustafa Acar
  • Your City: Manchester
  • Your Slack Name: MustafaAcar-sys

Homework Details

  • Module: JavaScript
  • Week: 1

Notes

  • What did you find easy?
    creating variables

  • What did you find hard?
    Nested functions

  • What do you still not understand?

  • Any other notes?
    @Dominic-Taylor-Dev

@MustafaAcar-sys
Copy link
Copy Markdown
Author

Done except extra tasks

Comment thread mandatory/4-tax.js
function addTaxAndFormatCurrency() {}
function addTaxAndFormatCurrency(productPrice) {
return "£" + calculateSalesTax(productPrice).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.

Hi Mustafa I checked your code nice job all of tests has passsed. I like to use this method for getting decimal points that we need.

Copy link
Copy Markdown

@Dominic-Taylor-Dev Dominic-Taylor-Dev left a comment

Choose a reason for hiding this comment

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

Overall you did a great job here! Just a few comments for the future. The most important one in my opinion is to make sure you use let and const appropriately.

Comment on lines +3 to +14
function addNumbers(a, b, c) {
return a + b + c;
}

function introduceMe(name, age)
return "Hello, my name is " + name "and I am " age + "years old";
function introduceMe(name, age){
return "Hello, my name is " + name +" and I am " + age + " years old";
}

function getTotal(a, b) {
total = a ++ b;
total = a + b;

return "The total is total";
return "The total is "+ total;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Excellent work :)

Comment on lines +4 to 13
return word.trim();
}

function getStringLength(word) {
return "word".length();
return word.length;
}

function multiply(a, b, c) {
a * b * c;
return;
return a * b * c;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Excellent work :)

@@ -9,6 +9,8 @@ function combine2Words(word1, word2) {
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you add comments to explain the two functions above please?


function concatenate(firstWord, secondWord, thirdWord) {

return firstWord.concat(" ", 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.

Good job

Comment thread mandatory/4-tax.js

function calculateSalesTax() {}
function calculateSalesTax(productPrice) {
let productTax = (productPrice*20) / 100 + productPrice;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Don't forget to indent. If you set up prettier and 'format on save' correctly, then this should happen automatically: https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week1/tree/master/exercises/A-setup-ide

Let me know if you need any help with that

Comment thread mandatory/4-tax.js

function calculateSalesTax() {}
function calculateSalesTax(productPrice) {
let productTax = (productPrice*20) / 100 + productPrice;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm not sure if you were introduced to let vs const yet. This is a variable that doesn't need to change, so you'd be better off using const. See here: https://medium.com/javascript-scene/javascript-es6-var-let-or-const-ba58b8dcde75#:~:text=%60const%60%20is%20a%20signal%20that,always%20the%20entire%20containing%20function.

Comment thread mandatory/4-tax.js

function calculateSalesTax() {}
function calculateSalesTax(productPrice) {
let productTax = (productPrice*20) / 100 + productPrice;
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 more of an advanced comment, but it's usually bad to have 'magic numbers' in code i.e. any numbers that don't have an obvious meaning. So I'd advise using an extra line to explain that the 20 is the tax rate (the 100 is okay because it's obvious in the code that you're using it to make a percentage):

function calculateSalesTax(originalPrice) {
  const taxRate = 20;
  const taxOnOriginal = originalPrice * (taxRate / 100);
  return originalPrice + taxOnOriginal;
}

Comment thread mandatory/4-tax.js

function addTaxAndFormatCurrency() {}
function addTaxAndFormatCurrency(productPrice) {
return "£" + calculateSalesTax(productPrice).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.

Nice :)

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