Zubeda-Week1-JavaScript(extra+mandatory)home-work#10
Zubeda-Week1-JavaScript(extra+mandatory)home-work#10zubedauk wants to merge 24 commits intoCodeYourFuture:masterfrom
Conversation
|
week3-home work. |
|
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 :) |
EmilePW
left a comment
There was a problem hiding this comment.
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!
Your Details
Your Name:zubeda
Your City:Birmingham
Your Slack Name:zubeda khanum
Homework Details
Module:java script
Week:week1(extra+mandatory)