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

ZA2-Shafiek Davids- JavaScript-Core-1-Coursework-Week1 - #304

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

ZA2-Shafiek Davids- JavaScript-Core-1-Coursework-Week1 #304
shafiekdavids wants to merge 1 commit into
CodeYourFuture:masterfrom
shafiekdavids:master

Conversation

@shafiekdavids

@shafiekdavids shafiekdavids commented Jul 6, 2022

Copy link
Copy Markdown

Commit of exercises

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 README.md

Commit of exercises

@dschouw-CYF dschouw-CYF 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.

Awesome work Shafiek. Thanks so much for your submission.
One final suggestion, try and commit your work early and often 💻

var fullSentence = message + name + sentence + nameLength + sentenceEnd;

console.log(message);
console.log(fullSentence);

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 Shafiek 🔥
Works as expected, but maybe not all the parts of the string needs to be seperate variables.
Using template literals will make the code less cluttered and achieve the same result.

var numberOfStudents = 15;
var numberOfMentors = 8;

let preciseStudentPercentage = (numberOfStudents / 23) * 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.

Works as expected , well done.
As a suggestion, try to avoid magic numbers in your code.
Would the preciseStudentPercentage still be correct if the numberOfStudents or numberOfMentors changes ?
In this scenario, 23 is a "magic number". We know that it works now because that is the total of students + mentors, but what can we do to make it work if those values change?

@@ -1,5 +1,9 @@
// Write your function here

function createGreeting(name) {

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
function createGreeting(name) {
function createGreeting(name) {
// function createGreeting should also include the static text "Hello, my name is "

const greeting = createLongGreeting("Daniel", 30);

console.log(greeting);
function createLongGreeting(name, age) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Modifying the code from exercise3.js in this folder, can you modify createLongGreeting to return a greeting with both the name ( a string ) and an age ( a number ) ?

@@ -1,5 +1,16 @@
var mentor1 = "Daniel";
let mentor1 = "Daniel";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That's right!! 👍
Avoid var !! Thanks for that update Shafiek

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.

Nice use of chaining functions, well done

Comment thread mandatory/4-tax.js
*/

function addTaxAndFormatCurrency() {}
function addTaxAndFormatCurrency(currency) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using the hint in the comment (hint: you already wrote a function for this!), can you think of another way to calculate the tax in the addTaxAndFormatCurrency function? Remember, functions are written to be reusable and to prevent us from rewriting logic

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.

3 participants