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
NORTHWEST_4 - Mohammed_Alabdulhamid - JAVA-SCRIPT - WEEK_1 #142
Closed
Mohammedal-abdulhamid
wants to merge
6
commits into
CodeYourFuture:master
from
Mohammedal-abdulhamid:master
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
32439ce
exercise B
Mohammedal-abdulhamid 531b1fd
from A to D
Mohammedal-abdulhamid 6af81f5
from E to I
Mohammedal-abdulhamid 515fecc
all function exercises from J to L
Mohammedal-abdulhamid 90943f1
extra & mandatory
Mohammedal-abdulhamid 4a2406b
final attempt
Mohammedal-abdulhamid 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 @@ | ||
| console.log("Hello world"); | ||
| console.log("'Hello World. I just started learning JavaScript!'"); |
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 `greeting` | ||
|
|
||
| console.log(greeting); | ||
| var greeting = "Hello world"; | ||
| for (var x = 0; x < 3; x++) { | ||
| 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` | ||
|
|
||
| var message = "this is a string"; | ||
| var 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,6 @@ | ||
| // Start by creating a variable `message` | ||
| var greetingMassage = "hello ,"; | ||
| var myName = "my name is Mohammed !"; | ||
| var message = greetingMassage + myName; | ||
|
|
||
| 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` | ||
| const myName = "Mohammed"; | ||
| const myNameLength = myName.length; | ||
| var message = | ||
| " my name is " + | ||
| myName + | ||
| " and my name length is " + | ||
| myNameLength + | ||
| " characters long"; | ||
| console.log(message); | ||
|
|
||
| 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,7 @@ | ||
| const name = " Daniel "; | ||
|
|
||
| console.log(message); | ||
| var nameTrim = name.trim; | ||
|
|
||
| console.log(nameTrim); | ||
|
|
||
| //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,5 @@ | ||
| // Start by creating a variables `numberOfStudents` and `numberOfMentors` | ||
| var numberOfStudents = 15; | ||
| var numberOfMentors = 4; | ||
| var sumNumber = numberOfStudents + numberOfMentors; | ||
| console.log(sumNumber); |
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,11 @@ | ||
| var numberOfStudents = 15; | ||
| var numberOfMentors = 8; | ||
| var total = numberOfStudents + numberOfMentors; | ||
| var studentPercentage = (numberOfStudents / total) * 100; | ||
| var mentorsPercentage = (numberOfMentors / total) * 100; | ||
| var studentsRoughNo = Math.round(studentPercentage); | ||
| var mentorsRoughNo = Math.round(mentorsPercentage); | ||
| var student = " student percentage is " + studentsRoughNo + " %"; | ||
| var mentors = " mentors percentag is " + mentorsRoughNo + " %"; | ||
| console.log(student); | ||
| console.log(mentors); |
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 halve(number) { | ||
| return number / 2; | ||
| // complete the function here | ||
| } | ||
|
|
||
| var result = halve(12); | ||
| var result = halve(9); | ||
|
|
||
| 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,4 +1,5 @@ | ||
| function triple(number) { | ||
| return number * 3; | ||
| // complete function here | ||
| } | ||
|
|
||
|
|
||
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,4 +1,7 @@ | ||
| // Declare your function first | ||
| function divide(num1, num2) { | ||
| return num1 / num2; | ||
| } | ||
|
|
||
| var result = divide(3, 4); | ||
|
|
||
|
|
||
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,17 +1,18 @@ | ||||||
| // There are syntax errors in this code - can you fix it to pass the tests? | ||||||
|
|
||||||
| function addNumbers(a b c) { | ||||||
| function addNumbers(a ,b ,c) { | ||||||
| return a + b + c; | ||||||
| } | ||||||
|
|
||||||
| function introduceMe(name, age) | ||||||
| return "Hello, my name is " + name "and I am " age + "years old"; | ||||||
| return "Hello, my name is " + name + "and I am " + age + "years old"; | ||||||
|
|
||||||
| function getTotal(a, b) { | ||||||
| total = a ++ b; | ||||||
| total = a + b; | ||||||
|
|
||||||
| return "The total is total"; | ||||||
| return "The total is" + total; | ||||||
|
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.
Suggested change
|
||||||
| } | ||||||
| let x ; | ||||||
|
|
||||||
| /* | ||||||
| =================================================== | ||||||
|
|
||||||
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,16 +1,15 @@ | ||||||
| // The syntax for this function is valid but it has an error, find it and fix it. | ||||||
|
|
||||||
| function trimWord(word) { | ||||||
| return wordtrim(); | ||||||
| return word.trim(); | ||||||
| } | ||||||
|
|
||||||
| function getStringLength(word) { | ||||||
| return "word".length(); | ||||||
| return word.length(); | ||||||
|
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.
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| function multiply(a, b, c) { | ||||||
| a * b * c; | ||||||
| return; | ||||||
| return a * b * c; | ||||||
| } | ||||||
|
|
||||||
| /* | ||||||
|
|
||||||
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,14 +1,17 @@ | ||||||
| // Add comments to explain what this function does. You're meant to use Google! | ||||||
| function getRandomNumber() { | ||||||
| // take a random number and time it by 10 | ||||||
| return Math.random() * 10; | ||||||
| } | ||||||
|
|
||||||
| // Add comments to explain what this function does. You're meant to use Google! | ||||||
| function combine2Words(word1, word2) { | ||||||
| // add word1 and word2 | ||||||
| return word1.concat(word2); | ||||||
| } | ||||||
|
|
||||||
| function concatenate(firstWord, secondWord, thirdWord) { | ||||||
| return "firstWord" + "secondWord" + "thirdWord"; | ||||||
|
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.
Suggested change
|
||||||
| // Write the body of this function to concatenate three words together. | ||||||
| // Look at the test case below to understand what this function is expected to return. | ||||||
| } | ||||||
|
|
||||||
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.