Quiz: Inline (5-6)
Instruções:
Chame a função
emotions() para que ela imprima a saída que você vê abaixo, mas, em vez de passar a função laugh() como um argumento, passa uma expressão de função inline.emotions("happy", laugh(2)); // você pode utilizar a sua função laugh dos quizzes anteriores
Prints: "I am happy, haha!"
Código
function emotions(myString, myFunc) {
console.log("I am " + myString + ", " + myFunc(2));
}
// your code goes here
// call the emotions function here and pass in an
// inline function expression
emotions ("happy", function laugh(num){
var message = "";
for (var i=1; i <= num; i++){
message +="ha";
}
return message + "!";
}
)
Comentários
Postar um comentário