Mandatory & Extra(I have a problem with Magic Ball#531
Mandatory & Extra(I have a problem with Magic Ball#531KristinaDudnyk wants to merge 2 commits intoCodeYourFuture:masterfrom
Conversation
extra/3-magic-8-ball.js
Outdated
| let answer = shakeBall(); | ||
| console.log(answer); |
There was a problem hiding this comment.
It is not necessary to call that function again, better to remove it
extra/3-magic-8-ball.js
Outdated
| "Very doubtful.", | ||
| ]; | ||
|
|
||
| console.log("The ball has shaken!"); |
There was a problem hiding this comment.
this console.log has to be within shakeBall() function in order to pass the test
|
|
||
| function checkAnswer(answer) { | ||
| //Write your code in here | ||
| if ( |
There was a problem hiding this comment.
this loop with possible answers is pretty messed up, I tried it locally, but it makes mistakes. Just try to remove answers from the very positive section, it's going to give you "true" anyway. I would not say it's reliable. My advice is to rewrite it, using includes() method for each array with the answers
|
|
||
| // This should log "The ball has shaken!" | ||
| // and return the answer. | ||
| const answers = [ |
There was a problem hiding this comment.
Try to break this array into four arrays and then put them into one. e.g
veryPositive = [];
positive = [];
You can use spread operator
answers[...verypositive, ...positive]
extra/3-magic-8-ball.js
Outdated
| return result; | ||
| } | ||
|
|
||
| console.log(shakeBall()); |
|
|
||
| function convertToUSD() {} | ||
| function convertToUSD(pound) { | ||
| return pound * 1.4; |
There was a problem hiding this comment.
a tip to make your code easier to understand for others, and yourself in future: you can assign numbers to variables so you know what they represent, e.g.
const exchangeRate = 1.4;
return pound * exchangeRate;
| function convertToBRL(pound) { | ||
| let fee = pound / 100; | ||
| let converting = (pound - fee) * 5.7; | ||
| return Number(converting.toFixed(2)); |
There was a problem hiding this comment.
Nice job using .toFixed() and then converting it back to a Number again 👍
| function addTaxAndFormatCurrency() {} | ||
| function addTaxAndFormatCurrency(sele) { | ||
| let selesWithTaxes = calculateSalesTax(sele); | ||
| let plusDecimalToSeles = selesWithTaxes.toFixed(2); |
There was a problem hiding this comment.
nice job breaking the steps down by assigning values to named variables
Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in
HOW_TO_MARK.mdin the root of this repositoryYour Details
Homework Details
Notes
What did you find easy?
What did you find hard?
What do you still not understand?
Magic Ball
Any other notes?