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

WM4_Dawit-Abraha_JavaScript_Core-1_Week-1 - #323

Closed
Dawit-Dev wants to merge 6 commits into
CodeYourFuture:masterfrom
Dawit-Dev:master
Closed

WM4_Dawit-Abraha_JavaScript_Core-1_Week-1#323
Dawit-Dev wants to merge 6 commits into
CodeYourFuture:masterfrom
Dawit-Dev:master

Conversation

@Dawit-Dev

@Dawit-Dev Dawit-Dev commented Aug 2, 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: Dawit Abraha
  • Your City: Coventry
  • Your Slack Name: Dawit Abraha

Homework Details

  • Module: JavaScript_Core-1
  • Week: 1

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

@Mesgna616 Mesgna616 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.

Dawit, your codes are neat and easy to read and understand them. And the way you tackle the problems is good and i like analytical approach.

@kawaMANMI kawaMANMI 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.

Well done Dawit! overall very good starting in JavaScript

var messageStart = "My name is";
var messageMiddle = "and my name is";
var messageEnd = "charactors long";
var nameLength = name.nameLength;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I am not clear what do yo mean by nameLength = name.nameLength? where did you already declared nameLength

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I appreciate the comments. I'll make it right.

function halve(number) {
var number = 12;
// complete the function here
return number - (number / 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 way to define halve number - (number / 2) you can also just divide the
number by 2

@@ -1,7 +1,11 @@
function triple(number) {
// complete function here
var number = 12;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think you don't need write step 3 (var number = 12;) as passed "number" as parameter in the function.

return word1.concat(word2);
}
//*
// This function will join the two words without space between them.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
// This function will join the two words without space between them.
// This function will join the two words with a space between them.

}

//*
// The random() method returns a random value that is greater than or equal to 0.0 and less than 1.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.

Nice explanation!

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).concat(" ", 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.

I like the way you've called .concat() on the result of .concat()! Are you able to explain why this works?

Comment thread mandatory/4-tax.js

function calculateSalesTax() {}
function calculateSalesTax(price) {
let salesTax = (price * 20) / 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.

This confused me to begin with as to why you were multiplying the price by 20. 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 = 20;

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

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.

5 participants