London Class 7 - Ionut Tripa - Javascript Core 1 - Week 1 - #32
Conversation
| @@ -1,3 +1,3 @@ | |||
| // Start by creating a variable `greeting` | |||
|
|
|||
| var greeting = 'Hello sunshine' | |||
There was a problem hiding this comment.
Perhaps you could add a (;) at the end of the variable
| @@ -1,4 +1,5 @@ | |||
| // Write your function here | |||
| const createGreeting = firstName => 'Hi ' + firstName + ', How are you?'; | |||
There was a problem hiding this comment.
Nice use of syntax and labels for variables
oksygenn
left a comment
There was a problem hiding this comment.
Great job with the homework Johnny!
Loved the short functions :)
Only had one suggestion about hard-coded values.
| var numberOfStudents = 15; | ||
| var numberOfMentors = 8; | ||
|
|
||
| var percentageOfStudents = Math.round(15*100/23) + '%'; | ||
| var percentageOfMentors = Math.round(8*100/23) + '%'; | ||
|
|
||
| console.log(percentageOfStudents); | ||
| console.log(percentageOfMentors); |
There was a problem hiding this comment.
Hi Johnny,
I have a little suggestion :)
You could add variables numberOfStudents and numberOfMentors and save the result to a new variable like total and then use all these variables in Math.round() instead of just using numbers(15, 8, 23). Something like this: Math.round(numberOfStudents*100/total).
This will make your code more flexible, so you can change numberOfStudents or numberOfMentors to any other numbers - percentage would still be calculated correctly 😉
Also, I believe the expected result was "Percentage students: 65%
Percentage mentors: 35%".
|
Your coursework submission has been closed because nobody has interacted with it in 30 days. You are welcome to re-open it to get more feedback. |
Your Details
Ionut Tripa
London
Johnny
Homework Details
Javascript Core 1
Week 1