Skip to content
This repository was archived by the owner on Oct 26, 2020. It is now read-only.

Zubeda-Week1-JavaScript(extra+mandatory)home-work#10

Open
zubedauk wants to merge 24 commits intoCodeYourFuture:masterfrom
zubedauk:master
Open

Zubeda-Week1-JavaScript(extra+mandatory)home-work#10
zubedauk wants to merge 24 commits intoCodeYourFuture:masterfrom
zubedauk:master

Conversation

@zubedauk
Copy link

Your Details

Your Name:zubeda
Your City:Birmingham
Your Slack Name:zubeda khanum

Homework Details

Module:java script
Week:week1(extra+mandatory)

@zubedauk
Copy link
Author

zubedauk commented Jul 4, 2020

week3-home work.
excercises+manadatory home work+extra home work

@zubedauk zubedauk changed the title zubeda-javaScript-week1(extra+mandatory)home-work Zubeda-Week3-JavaScript(extra+mandatory)home-work Jul 4, 2020
@zubedauk zubedauk changed the title Zubeda-Week3-JavaScript(extra+mandatory)home-work Zubeda-Week1-JavaScript(extra+mandatory)home-work Jul 4, 2020
@EmilePW EmilePW self-requested a review July 4, 2020 15:23
@EmilePW
Copy link

EmilePW commented Jul 4, 2020

Thanks @zubedauk, I'll try to review all of these this weekend. As a side note, I think you should make a separate pull request for each homework, but I'm not sure it matters too much.

@zubedauk
Copy link
Author

zubedauk commented Jul 4, 2020

Thanks @zubedauk, I'll try to review all of these this weekend. As a side note, I think you should make a separate pull request for each homework, but I'm not sure it matters too much.

hi,acutually its not my fault @EmilePW .if u see JavaScript-Core-1-Homework repository.it contain two instruction files(read files).when i forked the repository unfortunately i followed the 2nd one and worked on master file,after that i came to know i had to follow the 1st instruction file but at that time i already worked on master,so if i make branch its makes conflict ,so i worked 2nd and 3rd week on master and week 1st was already on master,hope you will understand :)

Copy link

@EmilePW EmilePW left a comment

Choose a reason for hiding this comment

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

Ah that's fine @zubedauk, I see what happened. I've left some comments below for homework 1 in any case. Will mark the others soon.


Homework JS1 Week 1

This is a great job overall, all of the answers are correct and you clearly understand the material. I've made a few notes on below which are mostly around programming style and making your code easier to read.

Make sure to use indentation and leave spaces between operators e.g. a%b should be a % b - this just makes the code easier to read.

Be careful to make sure that the variable names correspond to the values that they are supposed to hold. In the tax exercise, you use the salesTax variable to represent the base price plus 20%. The sales tax is just the 20% though, not the total.
That way, instead of:

function formatCurrency(a) {
var price=calculateSalesTax(a);

return `£${price.toFixed(2)}`;
}

you could have:

function formatCurrency(a) {
  var price = a + calculateSalesTax(a);

  return `£${price.toFixed(2)}`;
}

and the calculateSalesTax function should just calculate the 20% of the price (ideally a should have a more descriptive name too).


For the extra exercises, your currency conversion was correct but I've rewritten it slightly below so that it repeats less. I've also moved the transaction fee out of the function and made it a const, since we don't expect it to change (this is good practice but I appreciate that the question didn't mention this):

const transactionFeePercentage = 0.01;

function convertToBRL(price) {
  let priceInBRL = 5.7 * price;
  let totalPrice = priceInBRL + (transactionFeePercentage * priceInBRL);
  return totalPrice;
}

For the magic ball exercise, your answers are close to being correct but the code is a little messy. If created a gist here which you can compare to. (I've used the .include method which I'm not sure whether you had encountered when you did the homework, but there are other ways you could do this using direct comparison of array elements (with ===).

As I said great job overall!

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.

2 participants