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

Conversation

SalihaPopal
Copy link

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?

@@ -1,16 +1,17 @@
// There are syntax errors in this code - can you fix it to pass the tests?

function addNumbers(a b c) {
function addNumbers(a, b, c) {
return a + b + c;
}

Choose a reason for hiding this comment

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

Comment: Well done! Same as answers as me.
Consider: It makes no difference in the outcome. Sometimes you have space in between curly brackets and sometimes not. I do the same.

Copy link

Choose a reason for hiding this comment

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

Good work Saliha. 👍

@@ -1,16 +1,15 @@
// The syntax for these functions is valid but there are some errors, find them and fix them

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.

Comment: Looks good and same answers as me on all three.

Copy link

Choose a reason for hiding this comment

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

Good work Saliha. 👍

}

// Add comments to explain what this function does. You're meant to use Google!
function combine2Words(word1, word2) {
return word1.concat(word2);
// this function combine two strings and make a new string.

Choose a reason for hiding this comment

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

Comment: Good description.

Copy link

Choose a reason for hiding this comment

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

Good work Saliha. 👍

}

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.

Comment: same answer as me.


function format(value) {
let currency = "£"
return "£" + value;
}

const startingValue = 2;

// Why can this code be seen as bad practice? Comment your answer.

Choose a reason for hiding this comment

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

Question: have we answered the question here

Copy link
Author

Choose a reason for hiding this comment

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

If the starting value is not a number, the code may return an error.
If the add (10) or multiply (2) in functions are not defined , the code may not produce the correct result.
If the format function is not defined or doesn't behave as expected, the code may not produce the desired string representation of the result.

Outlook not so good.
Very doubtful.
*/
**/

Choose a reason for hiding this comment

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

praise: nice converting them all to arrays of strings


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.

praise: Nice use of template literals here

function convertToBRL() {}
function convertToBRL(amount) {
let rate = 5.7;
return parseFloat((amount * 5.7 * 0.99).toFixed(2));
Copy link
Author

Choose a reason for hiding this comment

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

Math.round(priceInBRL * 100) / 100; is used in
JavaScript-Core-1-Coursework-Week1-Solution


function format(value) {
let currency = "£"
return "£" + value;
}

const startingValue = 2;

// Why can this code be seen as bad practice? Comment your answer.
Copy link
Author

Choose a reason for hiding this comment

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

If the starting value is not a number, the code may return an error.
If the add (10) or multiply (2) in functions are not defined , the code may not produce the correct result.
If the format function is not defined or doesn't behave as expected, the code may not produce the desired string representation of the result.

@SalihaPopal SalihaPopal requested a review from softacoder March 21, 2023 22:20
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