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

London Class 7 - Somayeh Karimi - JavaScript - Week 1 - #55

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

London Class 7 - Somayeh Karimi - JavaScript - Week 1#55
DibaKarimi wants to merge 1 commit into
CodeYourFuture:masterfrom
DibaKarimi:master

Conversation

@DibaKarimi

Copy link
Copy Markdown

Your Details

  • Your Name: Somayeh Karimi
  • Your City: London
  • Your Slack Name: Somayeh Kr

Homework Details

  • Module: JavaScript
  • Week:1

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

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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing a Semi-colon.

@@ -1,2 +1,12 @@
var numberOfStudents = 15;
var numberOfMentors = 8;
var percentageOfStudent = Math.round(

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 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`;

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 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;

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 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;

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 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 :

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

while this statment is partially true, 10 is not included. Math.random() always returns a vlaue between 0 (inclusive) and 1 (exclusive)

@Jpsi Jpsi assigned Jpsi and unassigned Jpsi Feb 11, 2021
@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.

3 participants