Javascript
JavaScript Fundamentals -- Functions in JavaScript

Functions in JavaScript Exercise 1

PRO
Outline

For the first exercise in this section, you should:

// 1. Write a named function that logs the "name" parameter to the console

// 2. Write an arrow function that adds two numbers together using implicit return. Print the result to the console.

// 3. Write an arrow function that subtracts two numbers, not using implicit return. Print the result to the console.

// 4. Add a named function to the pizza object called "cook". Print a message to the console saying how long it will take to cook
const pizza = {
  name: 'Pepperoni'
};

// 5. Add an arrow function to the dog object that logs "bark, bark" to the console when called.
const dog = {
  name: 'Duke'
};

// 6. Add an anonymous function to the ice cream object called "eat" that logs a message saying the ice cream is being eaten
const iceCream = {
  name: 'vanilla',
}

To do this exercise, fork this StackBlitz project.

 

I finished! On to the next chapter