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

SOUTH_AFRICA - ERICK MULINDI - JAVASCRIPT_CORE_1 - WEEK_6 - #50

Closed
mulindierick wants to merge 1 commit into
CodeYourFuture:masterfrom
mulindierick:master
Closed

SOUTH_AFRICA - ERICK MULINDI - JAVASCRIPT_CORE_1 - WEEK_6#50
mulindierick wants to merge 1 commit into
CodeYourFuture:masterfrom
mulindierick:master

Conversation

@mulindierick

Copy link
Copy Markdown
Member

finished the mandatory and exercise Javascript home

Your Details

  • Your Name: Erick Mulindi
  • Your City: Cape Town, South Africa
  • Your Slack Name: Erick Mulindi

Homework Details

  • Module: JavaScript Core 1
  • Week: 6

finished the mandatory and exercise Javascript home
Comment thread mandatory/4-tax.js

function addTaxAndFormatCurrency() {}
function addTaxAndFormatCurrency(price) {
return "£" + parseFloat(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.

Good coding there. Use of parseFloat to avoid TypeError when applying the "toFixed" method

Comment thread mandatory/4-tax.js
*/

function calculateSalesTax() {}
function calculateSalesTax(price, item) {

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 second parameter "item" is never used

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ohh yeah, I forgot to delete that

@@ -1,14 +1,17 @@
// Add comments to explain what this function does. You're meant to use Google!
// return a radom number between 1 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.

its between 0 and 10 actually

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, thanks again... surprising how it's hard to detect some of these things

}

function concatenate(firstWord, secondWord, thirdWord) {
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.

Hey great work just some refactoring tip here...

- return firstWord.concar(" "+secondWord + " ", thirdWord);
+ return `${firstWord} ${secondWord}, ${thirdWord}`;
  • So your solution there works but prone to errors that can be caused by mistake you can miss on spacing your quotation marks then the words get attached together as one word which is something you did not intend to do
  • So template literals tend to be the most effective in concatenating strings etc

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

Nice work Erick. As time goes on try to use more of 'Template literals' for readability. 👍

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

F-string-method-- exercise 2: you should check the length of nameTrim not the name containing the extra spaces.
extra exercise is untouched
mandatoy-4-tax: second parameter is not used.

const name = " Daniel ";
var firstName = " Daniel ";
var nameTrim = firstName.trim();
var firstNameLength = firstName.length;

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 should check the length of nameTrim not the name containing the extra spaces.

var firstNameLength = firstName.length;
var message = "My name is " + nameTrim + " and my name is " + firstNameLength + " characters long."

console.log(message);

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 code did not meet the requirement because you're getting the wrong name length

Comment thread mandatory/4-tax.js
*/

function calculateSalesTax() {}
function calculateSalesTax(price, item) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

second parameter is not used.

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

F-string-method-- exercise 2: you should check the length of nameTrim not the name containing the extra spaces.
extra exercise is untouched
mandatoy-4-tax: second parameter is not used.

@github-actions

Copy link
Copy Markdown

Your coursework submission has been closed because nobody has interacted with it in six weeks. You are welcome to re-open it to get more feedback.

@github-actions github-actions Bot added the Stale label May 13, 2021
@github-actions github-actions Bot closed this May 13, 2021
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