This repository was archived by the owner on Jan 14, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 475
London Class 8 - Davood Khoshnood - JavaScript - Core 1 - Week 1 #237
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7ac2c98
London class 8 - Davood Khoshnood - JavaScript Core 1 - week 1
DavoodKhoshnood 4b660d5
Merge branch 'master' of https://github.com/CodeYourFuture/JavaScript…
DavoodKhoshnood d28e507
London Class 8 - Davood Khoshnood - JavaScript - Core 1 - Week 1
DavoodKhoshnood cd1076f
last update
DavoodKhoshnood abbbb0b
new update
DavoodKhoshnood fc77c68
new update
DavoodKhoshnood File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| // Use IntelliSense to learn about possible attributes. | ||
| // Hover to view descriptions of existing attributes. | ||
| // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
|
|
||
| { | ||
|
|
||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,6 @@ | ||
| console.log("Hello world"); | ||
| console.log("Hello world!"); | ||
| console.log("Hello world. I just started learning JavaScript!"); | ||
| console.log("Happy new year!"); | ||
| console.log("I'm trying to use more console.log!"); | ||
|
|
||
| console.log(456); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| // Start by creating a variable `greeting` | ||
| let greeting='Hello world' | ||
|
|
||
| console.log(greeting); | ||
| console.log(greeting); | ||
| console.log(greeting); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| // Start by creating a variable `message` | ||
|
|
||
| console.log(message); | ||
| let message = 'This is a string' | ||
| let messageType = typeof message | ||
|
|
||
| console.log(message) | ||
| console.log(messageType) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| // Start by creating a variable `message` | ||
|
|
||
| console.log(message); | ||
| const greetingStart = 'Hello, my name is ' | ||
| const myName = 'Daniel' | ||
|
|
||
| let greeting = greetingStart + myName | ||
|
|
||
| console.log(greeting) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,9 @@ | ||
| // Start by creating a variable `message` | ||
|
|
||
| console.log(message); | ||
| let name = 'Davood' | ||
| let lengthName = name.length | ||
|
|
||
| let message = | ||
| 'My name is ' + name + ' and my name is ' + lengthName + ' characters long' | ||
|
|
||
| console.log(message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,11 @@ | ||
| const name = " Daniel "; | ||
| const name = ' Daniel ' | ||
| let lengthName = name.length | ||
|
|
||
| console.log(message); | ||
| let message = | ||
| 'My name is ' + | ||
| name.trim() + | ||
| ' and my name is ' + | ||
| lengthName + | ||
| ' characters long' | ||
|
|
||
| console.log(message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,10 @@ | ||
| // Start by creating a variables `numberOfStudents` and `numberOfMentors` | ||
|
|
||
| let numberOfMentors = 22 | ||
| let numberOfStudents = 43 | ||
|
|
||
| let total = numberOfStudents + numberOfMentors | ||
|
|
||
| console.log('Number of mentors: ' + numberOfMentors) | ||
| console.log('Number of students: ' + numberOfStudents) | ||
| console.log('Total number of mentors and students: ' + total) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,10 @@ | ||
| var numberOfStudents = 15; | ||
| var numberOfMentors = 8; | ||
| let numberOfStudents = 15 | ||
| let numberOfMentors = 8 | ||
|
|
||
| let total = numberOfStudents + numberOfMentors | ||
|
|
||
| let percentageStudents = (numberOfStudents * 100) / total | ||
| let percentageMentors = (numberOfMentors * 100) / total | ||
|
|
||
| console.log('Percentage students: ' + Math.round(percentageStudents) + '%') | ||
| console.log('Percentage mentors: ' + Math.round(percentageMentors) + '%') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,12 @@ | ||
| function halve(number) { | ||
| // complete the function here | ||
| return number * 2 | ||
| } | ||
|
|
||
| var result = halve(12); | ||
| let result = halve(12) | ||
| let result2 = halve(52) | ||
| let result3 = halve(6) | ||
|
|
||
| console.log(result); | ||
| console.log(result) | ||
| console.log(result2) | ||
| console.log(result3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| function triple(number) { | ||
| // complete function here | ||
| return number * 3 | ||
| } | ||
|
|
||
| var result = triple(12); | ||
| let result = triple(12) | ||
|
|
||
| console.log(result); | ||
| console.log(result) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| // Complete the function so that it takes input parameters | ||
| function multiply() { | ||
| function multiply(num1, num2) { | ||
| // Calculate the result of the function and return it | ||
| return num1 * num2 | ||
| } | ||
|
|
||
| // Assign the result of calling the function the variable `result` | ||
| var result = multiply(3, 4); | ||
| let result = multiply(3, 4) | ||
|
|
||
| console.log(result); | ||
| console.log(result) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| // Declare your function first | ||
| function divide(num1, num2) { | ||
| return num1 / num2 | ||
| } | ||
|
|
||
| var result = divide(3, 4); | ||
| let result = divide(3, 4) | ||
|
|
||
| console.log(result); | ||
| console.log(result) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| // Write your function here | ||
| function createGreeting(name) { | ||
| return 'Hello, my name is ' + name | ||
| } | ||
|
|
||
| var greeting = createGreeting("Daniel"); | ||
| let greeting = createGreeting('Daniel') | ||
|
|
||
| console.log(greeting); | ||
| console.log(greeting) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| // Declare your function first | ||
| function sumNumbers(num1, num2) { | ||
| return num1 + num2 | ||
| } | ||
|
|
||
| // Call the function and assign to a variable `sum` | ||
| let sum = sumNumbers(13, 124) | ||
|
|
||
| console.log(sum); | ||
| console.log(sum) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,19 @@ | ||
| function greeting(name) { | ||
| return 'HELLO ' + name.toUpperCase(); | ||
| } | ||
|
|
||
|
|
||
| var mentor1 = "Daniel"; | ||
| var mentor2 = "Irina"; | ||
| var mentor3 = "Mimi"; | ||
| var mentor4 = "Rob"; | ||
| var mentor5 = "Yohannes"; | ||
|
|
||
|
|
||
|
|
||
| console.log(greeting(mentor1)); | ||
| console.log(greeting(mentor2)); | ||
| console.log(greeting(mentor3)); | ||
| console.log(greeting(mentor4)); | ||
| console.log(greeting(mentor5)); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Davood, i would recommend you use let rather than var. It is an outdated way to name variables and let is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Teniolao, I've changed and committed it again. thanks.