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

London class 9 - Natalie Zablotska - JavaScript - Core - 1 - Week1#444

Open
nataliiazab wants to merge 11 commits into
CodeYourFuture:masterfrom
nataliiazab:master
Open

London class 9 - Natalie Zablotska - JavaScript - Core - 1 - Week1#444
nataliiazab wants to merge 11 commits into
CodeYourFuture:masterfrom
nataliiazab:master

Conversation

@nataliiazab
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: Natalie Zablotska
  • Your City: London
  • Your Slack Name: Natalie

Homework Details

  • Module: JS
  • Week: 1

Notes

  • What did you find easy?

  • What did you find hard?

  • What do you still not understand?

  • Any other notes?

@nataliiazab nataliiazab marked this pull request as draft November 24, 2022 23:43
@nataliiazab nataliiazab marked this pull request as ready for review November 24, 2022 23:44
@nataliiazab
Copy link
Copy Markdown
Author

@Hamisakim please review the js tasks once you have time. thanks!!

@Hamisakim Hamisakim self-requested a review November 25, 2022 11:24
var greeting = 'Hi, my name is ';
var myName = 'Natalie.';

message = greeting + myName;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

we need to define message with const message = greeting + myName;


let myName = name.trim();
let nameLength = myName.length;
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.

again here add const

Copy link
Copy Markdown

@Hamisakim Hamisakim left a comment

Choose a reason for hiding this comment

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

Hey Natalie. Not your fault since the examples used this, but going forwards always use let or const when defining variables. var is not used anymore :)

In some places you were able to define a variable like message = a + b this is because your IDE is not using javascript in strict mode. I'll talk about this in class more, but have a read online about this

Another way, which i prefer, to concate strings is a string literal have a look below.
Both messages will output the same

const name = 'John Doe'
const age = '30'
const job = 'Web Developer'
const message = `My name is ${name} and I am ${age} years old. I am a ${job}` 
const message1 = 'My name is ' + name + ' and I am ' + age + ' years old. I am a ' + job 
// My name is John Doe and I am 30 years old. I am a Web Developer

If you need more clarity let me know

var numberOfStudents = 15;
var numberOfMentors = 8;
let total = numberOfMentors + numberOfStudents;
console.log('Total number of students and mentors:' + ' ' + total); 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.

You can add a space at the end of the string here rather than having + ' '
console.log('Total number of students and mentors: ' + total);

total = a ++ b;

return "The total is total";
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.

add a const here

@nataliiazab
Copy link
Copy Markdown
Author

thanks very much for the comments, @Hamisakim . This is noted

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