Challenge: Write a Function – My Name
Task
Implement a function to output a sentence:
- Name the function
myName
. - The function should accept one argument,
name
. - The
myName
function body should contain aconsole.log()
statement that prints the sentence"My name is {name}"
. - Call the
myName
function three times with different names.
1234567function ___(___) { console.log("My name is", ___); }; myName("___"); myName("___"); myName("___");
The output should be:
My name is {name}
My name is {name}
My name is {name}
- Function definition:
function funcName(argument) {}
. - Place the argument name inside the
console.log()
function. - Call the function with different names (choose them yourself).
- Call the
funcName
function after defining it using thefuncName(value)
syntax.
1234567function myName(name) { console.log("My name is", name); } myName("Ashley"); myName("Ervin"); myName("Mabel");
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 6. Capítulo 3
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Awesome!
Completion rate improved to 2.33
Challenge: Write a Function – My Name
Deslize para mostrar o menu
Task
Implement a function to output a sentence:
- Name the function
myName
. - The function should accept one argument,
name
. - The
myName
function body should contain aconsole.log()
statement that prints the sentence"My name is {name}"
. - Call the
myName
function three times with different names.
1234567function ___(___) { console.log("My name is", ___); }; myName("___"); myName("___"); myName("___");
The output should be:
My name is {name}
My name is {name}
My name is {name}
- Function definition:
function funcName(argument) {}
. - Place the argument name inside the
console.log()
function. - Call the function with different names (choose them yourself).
- Call the
funcName
function after defining it using thefuncName(value)
syntax.
1234567function myName(name) { console.log("My name is", name); } myName("Ashley"); myName("Ervin"); myName("Mabel");
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 6. Capítulo 3