Start learning free

LESSON 42 OF 671 · FUNCTIONS I

Exercise: Create Function with Parameters in JavaScript

Practice

We've written this code:

console.log("My name is Andy");
console.log("I code in Python");
console.log("I have a dog");

console.log("My name is Mike");
console.log("I code in Java");
console.log("I have a cat");

console.log("My name is Sarah");
console.log("I code in JavaScript");
console.log("I have a parrot");

Write the same code in a better way by creating and calling a function with parameters printMessages()

STEP 1 OF 5
    Ctrl + Enter to check