Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions assignments/function-conversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,28 @@
// console.log("Function was invoked!");
// };
// myFunction();

let myFunction = () => "Function was invoked"; //<---- which is correct?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They wanted let myFunction = () => console.log("Function was invoked"), but that is honestly close enough that I can see you know what you are doing.

// let anotherFunction = function (param) {
// return param;
// };
// anotherFunction("Example");

let anotherFunction = (param) => "Example";
// let add = function (param1, param2) {
// return param1 + param2;
// };
// add(1,2);

let add = (param1, param2) => param1 + param2;
// let subtract = function (param1, param2) {
// return param1 - param2;
// };
// subtract(1,2);

let subtract = (param1, param2) => param1 - param2;

// Stretch

// exampleArray = [1,2,3,4];
//exampleArray = [1,2,3,4];
// const triple = exampleArray.map(function (num) {
// return num * 3;
// });
// console.log(triple);
// console.log(triple);
// ??? const triple = exampleArray.map(num) => num * 3; ??????????

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really close. Map takes the callback, which you wrote perfectly, as an argument. It would be const triple = exampleArray.map((num) => num * 3);

2 changes: 1 addition & 1 deletion assignments/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const example = {
}

// Write your intern objects here:

console.log(example.key());

// ==== Challenge 2: Reading Object Data ====
// Once your objects are created, log out the following requests from HR into the console:
Expand Down