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
Amanda-Nwadukwe_JS-Core1-Week1 #215
Closed
Closed
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,10 @@ | ||
| console.log("Hello world"); | ||
|
|
||
| //logging several things at once to the console: | ||
| console.log("This is one statement\n", "This is another statement\n", "This is a " + "concatenation"); | ||
|
|
||
| //When I omit the quote marks, I get a syntax error | ||
| console.log("Hello world, I just started learning JavaScript!"); | ||
|
|
||
| //When I console.log a number without quotes, the logo is logged in the console | ||
| console.log(232); |
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` | ||
| var greeting = "Good day!"; | ||
|
|
||
| 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,9 @@ | ||
| // Start by creating a variable `message` | ||
| var message = "I am learning a lot about strings"; | ||
|
|
||
| //Type of message | ||
| var messageType = typeof message; | ||
|
|
||
| //Logging to the console | ||
| 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,7 @@ | ||
| // Start by creating a variable `message` | ||
| var greetingStart = "Hello, my name is "; | ||
| var myName = "Amanda"; | ||
| var message = greetingStart + myName; | ||
|
|
||
| //Logging to the console | ||
| 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,12 @@ | ||
| // Start by creating a variable `message` | ||
|
|
||
| //Storing my name in a variable | ||
| var myName = "Amanda"; | ||
|
|
||
| //Storing the length of my name in another variable | ||
| var myNameLength = myName.length; | ||
|
|
||
| var message = "My name is " + myName + " and my name is " + myNameLength + " characters long."; | ||
|
|
||
| //Logging to the console | ||
| 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,12 @@ | ||
| const name = " Daniel "; | ||
| //Storing my name in a variable | ||
| const myName = " Amanda "; | ||
|
|
||
| console.log(message); | ||
| const nameTrim = myName.trim(); | ||
|
|
||
| //Storing the length of my name in another variable | ||
| var myNameLength = nameTrim.length; | ||
|
|
||
| var message = "My name is " + nameTrim + " and my name is " + myNameLength + " characters long."; | ||
|
|
||
| //Logging to the console | ||
| console.log(message); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good bit of code! |
||
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,11 @@ | ||
| // Start by creating a variables `numberOfStudents` and `numberOfMentors` | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! |
||
| var numberOfStudents = 15; | ||
|
|
||
| var numberOfMentors = 8; | ||
|
|
||
| var total = numberOfStudents + numberOfMentors; | ||
|
|
||
| console.log("Number of students: " + numberOfStudents); | ||
| console.log("Number of mentors: " + numberOfMentors); | ||
| console.log("Total number of students and mentors: " + 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,17 @@ | ||
| var numberOfStudents = 15; | ||
| var numberOfMentors = 8; | ||
|
|
||
| //Finding the total | ||
| var total = numberOfStudents + numberOfMentors; | ||
|
|
||
| //Finding the percentages | ||
| var percentageOfStudents = (numberOfStudents / total) * 100; | ||
| var percentageOfMentors = (numberOfMentors / total) * 100; | ||
|
|
||
| //Rounding the percentages | ||
| var roundPercentageOfStudents = Math.round(percentageOfStudents); | ||
| var roundPercentageOfMentors = Math.round(percentageOfMentors); | ||
|
|
||
| //Logging to the console | ||
| console.log("Percentage students: " + roundPercentageOfStudents + "%"); | ||
| console.log("Percentage mentors: " + roundPercentageOfMentors + "%"); |
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,10 @@ | ||
| function halve(number) { | ||
| // complete the function here | ||
| //Completing the function | ||
| return number / 2; | ||
| } | ||
|
|
||
| var result = halve(12); | ||
| var result2 = halve(356); | ||
|
|
||
| console.log(result); | ||
| console.log(result2); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| // Declare your function first | ||
|
|
||
| function divide(a,b){ | ||
| return a / b; | ||
| } | ||
| var 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
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 sumNumbers(a,b){ | ||
| return a + b; | ||
| } | ||
| // Call the function and assign to a variable `sum` | ||
| var sum = sumNumbers(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,7 @@ | ||
| // Declare your function here | ||
|
|
||
| function createLongGreeting(name, age){ | ||
| return "Hello, my name is " + name + " and I am " + age + " years old"; | ||
| } | ||
| const greeting = createLongGreeting("Daniel", 30); | ||
|
|
||
| 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
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
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.
var is outdated use let or const