Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Write a Function – My Name | Functions in JavaScript
Introduction to JavaScript

bookChallenge: Write a Function – 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:

My name is {name}
My name is {name}
My name is {name}
  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

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

bookChallenge: Write a Function – 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:

My name is {name}
My name is {name}
My name is {name}
  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