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

WM4 - Simeon Bikov - JS - week 1 - #343

Open
simeonbikov wants to merge 5 commits into
CodeYourFuture:masterfrom
simeonbikov:master
Open

WM4 - Simeon Bikov - JS - week 1#343
simeonbikov wants to merge 5 commits into
CodeYourFuture:masterfrom
simeonbikov:master

Conversation

@simeonbikov

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: Simeon Bikov
  • Your City: West Midlands
  • Your Slack Name: simeonbikov

Homework Details

  • Module: JS
  • Week: 1

Notes

  • What did you find easy?

  • What did you find hard?

  • What do you still not understand?

  • Any other notes?

@PakizeBozkurt PakizeBozkurt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great job! Simon 👍

@RobCso RobCso left a comment

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 solutions, liked your use of let instead of var . Some lines of code could have been declared by using less lines of code but I am having the same issues and we'll improve as we learn new skills

@AlessandraCYF

Copy link
Copy Markdown

Uau, great work Simeon! As my test didn't even pass, I can't really say much.
Fantastic :)

@Lunamzelo

Copy link
Copy Markdown

Every thing looks perfect. Well done!

Comment thread mandatory/1-syntax-errors.js Outdated
total = a ++ b;

return "The total is total";
total = a + b;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do you remember what we need to put at the start of the line when defining or creating a new variable?

Comment thread mandatory/3-function-output.js Outdated
@@ -1,16 +1,15 @@
// Add comments to explain what this function does. You're meant to use Google!
// Return a random number between 0 and 10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What kind of number? Decimal? Integer? Positive or negative?

Comment thread mandatory/4-tax.js Outdated

function calculateSalesTax() {}
function calculateSalesTax(priceBeforeTax) {
let priceWithTax = priceBeforeTax * 1.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 confused me to begin with as to why you were multiplying the price by 1.2. One of the reasons is that I have no idea what the significance of that number is. In the industry we'd refer to this as a "magic number". It's considered better to treat it as a named constant defined somewhere in your code. Some people/organisations will capitalize shared constants, something like:

const TAX_RATE = 0.2;

function calculateSalesTax(price) {
    let tax = price * TAX_RATE;
    return price + tax;
}

Comment thread extra/1-currency-conversion.js Outdated
function convertToBRL() {}
function convertToBRL(amountGBP) {
let amountBRL = (amountGBP * 0.99) * 5.7;
amountBRL = Math.round((amountBRL + Number.EPSILON) * 100) / 100;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why did you use Number.EPSILON here?

Comment thread extra/3-magic-8-ball.js
function shakeBall() {
//Write your code in here
let randomNumber = Math.trunc(Math.random() * answers.length);
let randomAnswer = answers[randomNumber][0];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Impressive use of a "2D array"

Comment thread extra/3-magic-8-ball.js Outdated
//Write your code in here

function checkAnswer(randomAnswer) {
for (i = 0; i < answers.length; i++) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What keyword do we need to put in front of a new variable?

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.

6 participants