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

GLASGOW_CLASS_5_OMER_ALI_WEEK_1 - #176

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

GLASGOW_CLASS_5_OMER_ALI_WEEK_1#176
Omer249a wants to merge 1 commit into
CodeYourFuture:masterfrom
Omer249a:master

Conversation

@Omer249a

Copy link
Copy Markdown

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?

@alastair87
alastair87 self-requested a review July 31, 2021 04:53

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

Good work on parts A through G, though you should try and have a look at I through L. I can arrange a time to look at some of these with you if that would help.

@@ -1 +1 @@
console.log("Hello world");
console.log("Hello World. I just started learning JavaScript!");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Excellent.

// Start by creating a variable `greeting`

let greeting = "Hello";
console.log(greeting);

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 have declared and used the variable correctly however we also want you to print it three times. You could do this using a for loop as we have looked at for repeating code in class.

} else {
message = true;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's really good to try out different things like you've done here as it definitely helps with understanding them better!! However, if you do this you can also put it in a separate file just in case it interferes with the assigned task.



if (messageChoice == 0) {
message = "This is a string";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If you have a variable like messageChoice where you know what the type should be (this is true most of the time) it's good practice to use a strict equality check which means the === operator as opposed to ==. What this means is that the computer will check that not only do your variables / values represent the same 'soft value', but they also have the same type.

For example 0 == "0" is true, even though the left-hand value is a number and the right-hand value is a string. However 0 === "0" is false, since the values are not the same type.


console.log(`
${message}
${messageType}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Excellent. Good to try out string interpolation as a way of outputting variables.


greeting = greetingStart + MY_NAME;

console.log(greeting);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Excellent.

" and my name is " +
NAME_LENGTH +
" 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.

Excellent.

let message = "";

// Calculate total number of students
totalStudentsAndMentors = numberOfStudents + numberOfMentors;

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 simplify this by initialising the variable and setting its value at the same time.

I.e.:

let totalStudentsAndMentors = numberOfStudents + numberOfMentors;

(so you no longer need line 4)

message = `Number of students: ${numberOfStudents}
Number of mentors: ${numberOfMentors}
Total number of students and mentors: ${totalStudentsAndMentors}`;
console.log(message); No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Excellent. Again, you could do let message = on line 11 and define the variable at the same time as you set its value. This can sometimes be safer, as it means you'll get an error message saying the variable is undefined if you try to use it before it has been set correctly. This is helpful as then you'll know there's something wrong.

return (result = number / 2);
}

var result = halve(12);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Excellent.

@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 Sep 17, 2021
@github-actions github-actions Bot closed this Sep 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants