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

WM4 - Robert_Csonka - JavaScript_core1 - week_1 - #340

Open
RobCso wants to merge 4 commits into
CodeYourFuture:masterfrom
RobCso:master
Open

WM4 - Robert_Csonka - JavaScript_core1 - week_1 #340
RobCso wants to merge 4 commits into
CodeYourFuture:masterfrom
RobCso:master

Conversation

@RobCso

@RobCso RobCso commented Aug 4, 2022

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:
  • Your City:
  • Your Slack Name:

Homework Details

  • Module:
  • Week:

Notes

  • What did you find easy?

  • What did you find hard?

  • What do you still not understand?

  • Any other notes?


View rendered exercises/C-variables/README.md

@Know-Thyself Know-Thyself 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 job Robert!!

let number
console.log('number')
console.log(3434)
console.log("The third line will be an error")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just a minor correction: The third line would be undefined but not an error. It is a valid JavaScript to declare a variable and later assign a value to it like:

let number;
number = 33;

Also if you were trying to console log the third line in line number 4, you don't need to wrap it in a quotation as it is a variable. You can simply do console.log(number) which will print undefined in the console but console.log('number') gives you number as a string value.

var greeting = "Hello World!"
console.log(greeting);
console.log(greeting);
console.log(greeting);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The above lines work well.
You could also combine multiple console logs like this:
console.log(greeting, greeting, greeting)

var message
var name = "Robert"
var nameLength = name.length
message = "My name is " + name + " and my name is " + nameLength + " characters long"

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 and neat string concatenation!

function convertToUSD(poundToUsd) {
return poundToUsd * 1.4;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Well done on solving an extra assignment!!
The parameter poundToUsd sounds as if it's a function.
For further improvement, you may want to change it into pound, amountInPound, or something more semantic.

Comment thread mandatory/1-syntax-errors.js Outdated

function getTotal(a, b) {
total = a ++ b;
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.

The variable total hasn't been declared and it will give you a reference error.
You need something like:
let total = a + b;

function multiply(a, b, c) {
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.

You've spotted all the errors!
Great job!

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.

Well done!
Great comments and sound solutions!

Comment thread mandatory/4-tax.js
function addTaxAndFormatCurrency(price) {

return "£" + calculateSalesTax(price).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 and neat solution!

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