This repository was archived by the owner on Oct 26, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 42
JS/Week1/Ali Haider #69
Open
AliHaider-1
wants to merge
13
commits into
CodeYourFuture:master
Choose a base branch
from
AliHaider-1:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9494fe3
Week 1 Free Code Camp Exercises completed and screenshot uploaded.
AliHaider-1 918fc90
I installed the prettier and Enabled the formatting on save.
AliHaider-1 950965a
B- Hello World exercise is completed.
AliHaider-1 cc3cbff
exercise C- variables completed
AliHaider-1 8fa5de8
exercise D-strings Completed
AliHaider-1 fa01e58
exercise E strings concatenation completed.
AliHaider-1 238111f
F : exercise and exercise2 is completed
AliHaider-1 72fc5cd
exercise G-numbers completed
AliHaider-1 9cd55c9
exercise I-floats completed
AliHaider-1 16f8093
J : exercise and exercise2 is completed
AliHaider-1 dcfda0e
K : exercise , exercise2 , exercise3, exercise4 and exercise5 completed
AliHaider-1 79db1b5
L-functions-nested completed
AliHaider-1 f9ca1bb
Mandatory exercises completed
AliHaider-1 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 |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| // 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": [ | ||
| { | ||
| "type": "pwa-node", | ||
| "request": "launch", | ||
| "name": "Launch Program", | ||
| "skipFiles": [ | ||
| "<node_internals>/**" | ||
| ], | ||
| "program": "${workspaceFolder}\\week-1\\1-exercises\\B-hello-world\\exercise.js" | ||
| } | ||
| ] | ||
| } | ||
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,7 @@ | ||
| { | ||
| "editor.formatOnSave": true, | ||
| "editor.formatOnPaste": true, | ||
| "launch": { | ||
|
|
||
| } | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 +1,3 @@ | ||
| console.log("Hello world"); | ||
| console.log("Hello world, I am very excited about learning JavaScript."); | ||
| console.log("My name is Ali Haider"); | ||
| console.log(1234); |
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 `greeting` | ||
|
|
||
| var 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,5 @@ | ||
| // 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,5 @@ | ||
| // Start by creating a variable `message` | ||
|
|
||
| console.log(message); | ||
| var greetingStart = "Hello, my name is "; | ||
| var name = "Daniel"; | ||
| var greeting = greetingStart + name; | ||
| 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 name = "Ali Haider"; | ||
| var nameLength = name.length; | ||
| var greeting = "My name is "; | ||
| var greeting2 = " and my name is "; | ||
| var message = " characters long"; | ||
| var totalMessage = greeting + name + greeting2+ nameLength + message; | ||
| console.log(totalMessage); | ||
|
|
||
| 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,8 @@ | ||
| const name = " Daniel "; | ||
|
|
||
| console.log(message); | ||
| const name = " Ali Haider "; | ||
| var orignalName = name.trim(); | ||
| var orignalNameLength = orignalName.length; | ||
| var greeting = "My name is "; | ||
| var greeting2 = " and my name is "; | ||
| var message = " characters long"; | ||
| var totalMessage = greeting + orignalName + greeting2 + orignalNameLength+ message; | ||
| console.log(totalMessage); |
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,9 @@ | ||
| // Start by creating a variables `numberOfStudents` and `numberOfMentors` | ||
| var numberofStudents = 15; | ||
| var numberofMentors = 8; | ||
|
|
||
| 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 |
|---|---|---|
|
|
@@ -20,4 +20,4 @@ var roughAge = Math.round(preciseAge); // 30 | |
| ``` | ||
| Percentage students: 65% | ||
| Percentage mentors: 35% | ||
| ``` | ||
| ``` | ||
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; | ||
|
|
||
| total = numberOfStudents + numberOfMentors; | ||
|
|
||
| var percentageOfStudents = Math.round((numberOfStudents/total) * 100); | ||
| var percentageOfMentors = Math.round((numberOfMentors / total) * 100); | ||
|
|
||
| console.log("Percentage students: "+ percentageOfStudents+ "%"); | ||
| console.log("Percentage mentors: " + percentageOfMentors+ "%"); |
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,5 +1,8 @@ | ||
| // Declare your function first | ||
|
|
||
| function divide(num1,num2){ | ||
| var result = num1/num2 ; | ||
| return result; | ||
| } | ||
| 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,8 @@ | ||
| // Write your function here | ||
|
|
||
| function createGreeting(name){ | ||
| var message = "Hello, my name is "+ name; | ||
| return message; | ||
| } | ||
| var greeting = createGreeting("Daniel"); | ||
|
|
||
| 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,8 @@ | ||
| // Declare your function first | ||
|
|
||
| function add( num1 , num2){ | ||
| var addition = num1 + num2 ; | ||
| return addition; | ||
| } | ||
| // Call the function and assign to a variable `sum` | ||
|
|
||
| var sum = add(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,11 @@ | ||
| // Declare your function here | ||
|
|
||
| function createLongGreeting(name , age){ | ||
| var message = "Hello, my name is "; | ||
| var message2 = " and I'm "; | ||
| var message3 = " years old"; | ||
| var finalMessage = message + name + message2+ age + message3; | ||
| return finalMessage; | ||
| } | ||
| const greeting = createLongGreeting("Daniel", 30); | ||
|
|
||
| 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,13 @@ | ||
| var mentor1 = "Daniel"; | ||
| var mentor2 = "Irina"; | ||
| var mentor3 = "Mimi"; | ||
| var mentor4 = "Rob"; | ||
| var mentor5 = "Yohannes"; | ||
| function Percentage(numberOfStudents, numberOfMentors){ | ||
| var total = numberOfStudents + numberOfMentors; | ||
| var percentageOfStudents = Math.round((numberOfStudents / total) * 100); | ||
| var percentageOfMentors = Math.round((numberOfMentors / total) * 100); | ||
| return percentageOfMentors,percentageOfStudents; | ||
| } | ||
| function message(){ | ||
| console.log("Percentage students: " + Percentage(15,8) + "%"); | ||
| console.log("Percentage mentors: " + Percentage(8,15) + "%"); | ||
|
|
||
| } | ||
|
|
||
| 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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| var mentor1 = "Daniel"; | ||
| var mentor2 = "Irina"; | ||
| var mentor3 = "Mimi"; | ||
| var mentor4 = "Rob"; | ||
| var mentor5 = "Yohannes"; | ||
|
|
||
| function captilize(str){ | ||
|
|
||
| str.toUpperCase(); | ||
| return str.toUpperCase();; | ||
| } | ||
|
|
||
| function greetings(){ | ||
| // captilize(mentor1, mentor2, mentor3, mentor4, mentor5); | ||
| var msg = "HELLO "; | ||
| console.log( msg + captilize(mentor1)); | ||
| console.log(msg + captilize(mentor2)); | ||
| console.log(msg + captilize(mentor3)); | ||
| console.log(msg + captilize(mentor4)); | ||
| console.log(msg + captilize(mentor5)); | ||
|
|
||
| } | ||
| greetings(); |
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,16 +1,22 @@ | ||
| // Add comments to explain what this function does. You're meant to use Google! | ||
| // This function generate a random number between a range of 0 to 10. | ||
| // Math.random() generate a floating point number between a range of 0 to 1. | ||
| // In which 0 is inclusive and 1 is exclusive. | ||
| function getNumber() { | ||
| return Math.random() * 10; | ||
| } | ||
|
|
||
| // Add comments to explain what this function does. You're meant to use Google! | ||
| // concat() method is used to combine or join two strings. | ||
| // In this function w2 is added to the infront of w1. | ||
|
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. This is almost right! If you try running this function by providing string inputs |
||
| function s(w1, w2) { | ||
| return w1.concat(w2); | ||
| } | ||
|
|
||
| function concatenate(firstWord, secondWord, thirdWord) { | ||
| // Write the body of this function to concatenate three words together | ||
| // Look at the test case below to understand what to expect in return | ||
| 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. This definitely works but could you think of another way of doing this, perhaps using |
||
| } | ||
|
|
||
| /* ======= TESTS - DO NOT MODIFY ===== | ||
|
|
||
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.
Just to let you know, the reason this code has appeared red is because comments are not allowed in JSON files.