Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: My Name | Functions
Introduction to JavaScript
course content

Conteúdo do Curso

Introduction to JavaScript

Introduction to JavaScript

1. Basic Concepts
2. Variables and Data Types
3. Basic Operations
4. Conditional Statements
5. Loops
6. Functions

bookChallenge: 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.
1234567
function ___(___) { console.log("My name is", ___); }; myName("___"); myName("___"); myName("___");
copy

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.
1234567
function myName(name) { console.log("My name is", name); } myName("Ashley"); myName("Ervin"); myName("Mabel");
copy

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 6. Capítulo 3
some-alt