forked from bloominstituteoftechnology/JavaScript-I
-
Notifications
You must be signed in to change notification settings - Fork 0
Natalie davis #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
85afb6f
object class created
FreedomWriter 9e31705
objects mvp done
FreedomWriter 0c48a8b
working on arrays
FreedomWriter c178439
working on Arrays
FreedomWriter 8145a4c
functions conversion completed w/ stretch,
FreedomWriter 09406b2
arrays done, going back for the challenges
FreedomWriter e2e2619
arrays stretch goal completed
FreedomWriter c277500
still need to do object stretch
FreedomWriter d045fb5
fixed error
FreedomWriter 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
Binary file not shown.
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 |
|---|---|---|
|
|
@@ -5,26 +5,45 @@ | |
| // }; | ||
| // myFunction(); | ||
|
|
||
| let myFunction = () => console.log("Function was invoked!"); | ||
| myFunction(); | ||
|
|
||
| // let anotherFunction = function (param) { | ||
| // return param; | ||
| // }; | ||
| // anotherFunction("Example"); | ||
|
|
||
|
|
||
| let anotherFunction = (param) => {return param}; | ||
| console.log(anotherFunction('Example')); | ||
|
|
||
|
|
||
| // let add = function (param1, param2) { | ||
| // return param1 + param2; | ||
| // }; | ||
| // add(1,2); | ||
|
|
||
| let add = (param1, param2) => {return param1 + param2}; | ||
|
|
||
| console.log(add(1,2)); | ||
|
|
||
| // let subtract = function (param1, param2) { | ||
| // return param1 - param2; | ||
| // }; | ||
| // subtract(1,2); | ||
|
|
||
| let subtract = (param1, param2) => {return param1 - param2}; | ||
|
|
||
| console.log(subtract(1,2)); | ||
|
|
||
| // Stretch | ||
|
|
||
| // exampleArray = [1,2,3,4]; | ||
| // const triple = exampleArray.map(function (num) { | ||
| // return num * 3; | ||
| // }); | ||
| // console.log(triple); | ||
| // console.log(triple); | ||
|
|
||
| exampleArray = [1,2,3,4]; | ||
| const triple = exampleArray.map((num) => { | ||
| return num * 3; | ||
|
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. 👍 |
||
| }); | ||
| console.log(triple); | ||
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 |
|---|---|---|
|
|
@@ -19,26 +19,44 @@ const example = { | |
|
|
||
| // Write your intern objects here: | ||
|
|
||
|
|
||
| const Intern = function(id, name, email, gender) { | ||
| this.id = id; | ||
| this.name = name; | ||
| this.email = email; | ||
| this.gender = gender; | ||
| }; | ||
|
|
||
| const mitzi = new Intern(1, 'Mitzi', 'mmelloy0@PushSubscription.edu', 'F') | ||
| //console.log(mitzi); | ||
|
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. 🚀 |
||
| const kennan = new Intern(2, 'Kennan', 'kdiben1@tinypic.com', 'M') | ||
| //console.log(kennan); | ||
| const keven = new Intern(3, 'Keven', 'kummery2@wikimedia.org', 'M') | ||
| //console.log(keven); | ||
| const gannie = new Intern(4,'Gannie', 'gmartinson3@illinois.edu', 'M') | ||
| //console.log(gannie); | ||
| const antonietta = new Intern(5, 'Antonietta', 'adaine5@samsung.com', 'F') | ||
| //console.log(antonietta); | ||
| // ==== Challenge 2: Reading Object Data ==== | ||
| // Once your objects are created, log out the following requests from HR into the console: | ||
|
|
||
| // Mitzi's name | ||
|
|
||
| console.log(mitzi.name); | ||
| // Kennan's ID | ||
|
|
||
| console.log(kennan.id); | ||
| // Keven's email | ||
|
|
||
| console.log(keven.email); | ||
| // Gannie's name | ||
|
|
||
| console.log(gannie.name); | ||
| // Antonietta's Gender | ||
|
|
||
| console.log(antonietta.gender); | ||
| // ==== Challenge 3: Object Methods ==== | ||
| // Give Kennan the ability to say "Hello, my name is Kennan!" Use the console.log provided as a hint. | ||
| // console.log(kennan.speak()); | ||
| kennan.speak = function() { return `Hello, my name is ${this.name}`}; | ||
| console.log(kennan.speak(name)); | ||
|
|
||
| // Antonietta loves math, give her the ability to multiply two numbers together and return the product. Use the console.log provided as a hint. | ||
| //console.log(antonietta.multiplyNums(3,4)); | ||
| antonietta.multiplyNums = function(num1, num2) {return num1 * num2}; | ||
| console.log(antonietta.multiplyNums(3,4)); | ||
|
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. 👍 |
||
|
|
||
| // === Great work! === Head over to the the arrays.js file or take a look at the stretch challenge | ||
|
|
||
|
|
@@ -49,8 +67,6 @@ const example = { | |
| // 3. Nest a grandchild object in the child object with properties for name and age. The name will be Sam and the age will be 30 | ||
| // 4. Give each of the objects the ability to speak their names using the this keyword. | ||
|
|
||
| const parent = {} | ||
|
|
||
| // Log the parent object's name | ||
|
|
||
| // Log the child's age | ||
|
|
||
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.
change to be the correct car