Word Blanks how does it work excatly?

This challenge is using concepts not taught yet (function, parameters, and arguments). It has been fixed in the up coming version (that link will not stay up forever).

It is basically this challenge, but using a function with parameters getting passed arguments.

Let’s try with some code, see if it makes sense.

No function:

const animal = 'dog';
const sound = 'woof'

const sentence = 'My' + ' ' + animal + ' ' + 'says' + ' ' + sound;

console.log(sentence)
// My dog says woof

With function:

function MyAnimalWithSound(animal, sound) {
  const sentence = 'My ' + animal + ' says ' + sound;
  console.log(sentence)
}

MyAnimalWithSound('dog', 'woof');
// My dog says woof
2 Likes