course content

Course Content

Introduction to JavaScript

Challenge: My NameChallenge: My Name

Task

Implement a function to output a sentence:

  1. Name the function myName.
  2. The function should accept one argument, name.
  3. The myName function body should contain a console.log() statement that prints the sentence "My name is {name}".
  4. Call the myName function three times with different names.

The output should be:

1. Function definition: function funcName(argument) {}.
2. Place the argument name inside the console.log() function.
3. Call the function with different names (choose them yourself).
4. Call the funcName function after defining it using the funcName(value) syntax.

function myName(name) {
  console.log("My name is", name);
}

myName("Ashley");
myName("Ervin");
myName("Mabel");
      

Everything was clear?

Section 6. Chapter 3