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

Glasgow Class 6 Melese Berehannu js-1 week1#518

Open
Melesegithub wants to merge 1 commit intoCodeYourFuture:masterfrom
Melesegithub:master
Open

Glasgow Class 6 Melese Berehannu js-1 week1#518
Melesegithub wants to merge 1 commit intoCodeYourFuture:masterfrom
Melesegithub:master

Conversation

@Melesegithub
Copy link

js-1-week1

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?

js-1-week1
Copy link

@munozirianni1988 munozirianni1988 left a comment

Choose a reason for hiding this comment

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

Hi Melese, great job! Everything looks good. Just a wee suggestions, if you put a semicolon (;) at the ned of your return statement, I don't think you need parenthesis on it.

Copy link

@malkitbenning malkitbenning left a comment

Choose a reason for hiding this comment

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

Overall excellent - you have shown that you know how to code this level of JavaScript and how to debug. There are a few minor corrections in my review. Overall please note Jest generates its own tests so you don't need add your own.

total = (a + b);

return "The total is total";
return ('The total is ' + total);

Choose a reason for hiding this comment

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

Your changes will work, but another way would have been to include the total inside the string -
return (The total is ${total});

Copy link

@annacollins85 annacollins85 Mar 8, 2023

Choose a reason for hiding this comment

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

Don't forget the backticks though.

return `The total is ${total}`;

return "The total is total";
return ('The total is ' + total);
}
addNumbers(3,4,6);

Choose a reason for hiding this comment

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

You don't need to add your own tests as the Jest will run it's own tests.

getStringLength("Turtles");
getStringLength("A wild sentence appeared!");
multiply(2, 3, 6);
multiply(2, 3, 4);

Choose a reason for hiding this comment

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

No need to add your own tests - the system will do it's own tests.

@@ -1,18 +1,23 @@
// Add comments to explain what this function does. You're meant to use Google!
//This getRandomNumber function let you to get a random number greater than 0 and less than 10.

Choose a reason for hiding this comment

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

Well done on adding a comment here - many students missed this.

function concatenate(firstWord, secondWord, thirdWord) {
// Write the body of this function to concatenate three words together.
// Look at the test case below to understand what this function is expected to return.
return firstWord.concat(secondWord, thirdWord);

Choose a reason for hiding this comment

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

excellent!

*/

function calculateSalesTax() {}
function calculateSalesTax(product) {

Choose a reason for hiding this comment

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

Did this work? It looks like you are adding the tax to the original amount, but this should only be working out the tax. You should be adding the tax to the original amount later in the code.

Choose a reason for hiding this comment

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

Apologies Melese - you were right in the first place! You are supposed to calculate the full amount here - rather than just tax. I misunderstood the requirement.

return "£"+(Math.round(calculateSalesTax(product)).toFixed(2))

}
calculateSalesTax(15);

Choose a reason for hiding this comment

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

no need to include your own tests - the system generates its own tests.


function trimWord(word) {
return wordtrim();
return (word.trim());

Choose a reason for hiding this comment

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

No need for the extra brackets here,

return word.trim();

is enough.


function getStringLength(word) {
return "word".length();
return (word.length);

Choose a reason for hiding this comment

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

Same here, word.length without brackets is enough.

Copy link

@annacollins85 annacollins85 left a comment

Choose a reason for hiding this comment

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

Great work 👏

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.

4 participants