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 476
Final changes made WM CLASS 3- Georgina -Ashun- JavaScript-Core - Week1 #199
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| // Start by creating a variable `message` | ||
| var message = "This is a string"; | ||
| var messageType = typeof message; | ||
|
|
||
| console.log(message); | ||
| console.log(messageType); // logs 'string' |
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,5 @@ | ||
| // Start by creating a variable `message` | ||
|
|
||
| console.log(message); | ||
| const message = "Hello, my name is "; | ||
| const name = "Georgina"; | ||
| console.log(message + name); |
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,16 @@ | ||
| // Start by creating a variable `message` | ||
| // const myName = "Georgina"; | ||
| // var nameLength = Georgina.length; | ||
|
|
||
| // console.log(nameLength); // Logs 8 | ||
|
|
||
|
|
||
|
|
||
| const myName = "Georgina "; | ||
| console.log( | ||
| `My name is ${myName}, the length of my name is ${myName.length} characters` | ||
| ); | ||
| console.log(); | ||
|
|
||
|
|
||
|
|
||
| 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,13 @@ | ||
| const name = " Daniel "; | ||
| // const name = " Georgina "; | ||
|
|
||
| console.log(message); | ||
| // console.log( | ||
| // `My name is ${Name}, the length of my name is ${Name.length} characters` | ||
| // ); | ||
|
|
||
| // console.log(message); | ||
| const name = " Georgina "; | ||
| console.log( | ||
| `My name is ${name.trim()}, the length of my name is ${ | ||
| name.trim().length | ||
| } 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,7 @@ | ||
| // Start by creating a variables `numberOfStudents` and `numberOfMentors` | ||
| const numberOfStudents = "15"; | ||
| const numberOfMentors = "8"; | ||
|
|
||
| const sum = 15 + 8; // 23 | ||
|
|
||
| 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,21 @@ | ||
| var numberOfStudents = 15; | ||
| var numberOfMentors = 8; | ||
| const numberOfStudents = 15; | ||
| const numberOfMentors = 8; | ||
| const sum = numberOfStudents + numberOfMentors; | ||
|
|
||
| // console.log (TotalnumberOfStudents ${numberOfStudents} ); | ||
|
|
||
| // console.log (TotalnumberOfMentors ${numberOfMentors } ); | ||
|
|
||
| //console.log (TotalNumber ${totalNumber} ); | ||
|
|
||
| const percentageStudents = (numberOfStudents/sum) * 100;//65 | ||
|
|
||
| console.log (percentageStudents) | ||
|
|
||
| const percentageMentors = (numberOfMentors/sum) * 100;//34.7 (math.round =35 | ||
|
|
||
| console.log (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,16 @@ | ||
| function halve(number) { | ||
| // complete the function here | ||
|
|
||
| return number /2; | ||
| } | ||
|
|
||
| var result = halve(12); | ||
|
|
||
| console.log(result); | ||
| console.log(result);//6 | ||
|
|
||
| var result = halve(10); | ||
| console.log (result); //5 | ||
|
|
||
| var result = halve(100); | ||
| console.log (result); //50 | ||
|
|
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); | ||
|
|
||
| console.log(result); | ||
| console.log(result); //36 |
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,11 @@ | ||
| // Complete the function so that it takes input parameters | ||
| function multiply() { | ||
| function multiply (numberOne, numberTwo) { | ||
|
|
||
| // Calculate the result of the function and return it | ||
| return numberOne * numberTwo; | ||
| } | ||
|
|
||
| // Assign the result of calling the function the variable `result` | ||
| var result = multiply(3, 4); | ||
| var result = multiply(3, 4);//12 | ||
|
|
||
| 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,6 @@ | ||
| // Declare your function first | ||
|
|
||
| function divide(numberOne, numberTwo) { | ||
| return numberOne / numberTwo; | ||
| } | ||
| var result = divide(3, 4); | ||
|
|
||
| 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,9 @@ | ||
| // Write your function here | ||
| function greeting(greetingStart, name) {} | ||
| //var greeting = createGreeting("Daniel"); | ||
| var greetingStart = "Hello, my name is "; | ||
| var name = "Georgina"; | ||
|
|
||
| var greeting = createGreeting("Daniel"); | ||
| greeting = greetingStart + name; | ||
|
|
||
| console.log(greeting); | ||
| console.log(greeting); // Logs "Hello, my name is Georgina" |
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 addition(numberOne, numberTwo) { | ||
| return numberOne + numberTwo; | ||
| } | ||
| // Call the function and assign to a variable `sum` | ||
|
|
||
| const sum = addition(13, 124); | ||
| 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,10 @@ | ||
| // Declare your function here | ||
| //function greeting(greetingStart, name, age) { | ||
| function createLongGreeting(name, age) { | ||
| return `Hello, my name is ${name} and I'm ${age} years old`; | ||
| } | ||
|
|
||
| const greeting = createLongGreeting("Daniel", 30); | ||
| //var greeting = createGreeting("Georgina"); | ||
| const greeting = createLongGreeting("Georgina", 43); | ||
|
|
||
| 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
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
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
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.
really neat work Georgina, sorry the last line of the coding, in console.log you put new line sign, can you please explain how it worked :),
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.
Thanks Uzma, I'm learning something new each day. Using "/n" in the console.log lists each on a new line. I also learnt that you can even add some sort of margin at the start of each line if you list items like this - example:
console.log("one", "\n","two");