London Class 7 - Somayeh Karimi - JavaScript - Week 1 - #55
Conversation
Hozan94
left a comment
There was a problem hiding this comment.
Hi @DibaKarimi , your work is great and you did all the exercises successfuly, however I added some extra comments to see the where you can improve.
|
|
||
| console.log(message); | ||
| var greetingStart = "Hello, my name is "; | ||
| var name = "Somayeh" |
| @@ -1,2 +1,12 @@ | |||
| var numberOfStudents = 15; | |||
| var numberOfMentors = 8; | |||
| var percentageOfStudent = Math.round( | |||
There was a problem hiding this comment.
You can create a variable which can be called 'total' to add both 'numberOfStudents' and 'numberOfMentors' together, this will make the code easy to read.
|
|
||
| // Create a greeting message by name and age | ||
| function createLongGreeting(name, age) { | ||
| var message = `Hello, my name is ${name} and I'm ${age} years old`; |
There was a problem hiding this comment.
I belive for this particular function, there is no need to declare the variable message as it is only used inside the function, so you can write the code as return Hello, my name is ${name} and I'm ${age} years old;
| } | ||
| function createGreeting(name) { | ||
| var upName = upperCase(name); | ||
| var message = "HELLO " + upName; |
There was a problem hiding this comment.
I also think, your function 'createGreeting' can have two parameters, and the reason for that is what if we wanted to change the word 'HELLO' to something else later in future. And to do that you can write it like this :
function createGreeting(greeting, name){
var upName = upperCase(name);
var message = greeting.toUpperCase( ) + upName;
return message;
};
|
|
||
| function getTotal(a, b) { | ||
| total = a ++ b; | ||
| total = a + b; |
There was a problem hiding this comment.
this variables has not been declared so you can add var or let keyword.
| @@ -1,16 +1,15 @@ | |||
| // Add comments to explain what this function does. You're meant to use Google! | |||
| // returns a random number between 0 , and 10 : | |||
There was a problem hiding this comment.
while this statment is partially true, 10 is not included. Math.random() always returns a vlaue between 0 (inclusive) and 1 (exclusive)
|
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. |
Your Details
Homework Details