Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Write a Greeting Function | Functions in JavaScript
Introduction to JavaScript (copy with unittests)

bookChallenge: Write a Greeting Function

Task

Swipe to start coding

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.

The output should be:

My name is {name}
My name is {name}
My name is {name}

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 6. ChapterΒ 3
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

Awesome!

Completion rate improved to 2.5

bookChallenge: Write a Greeting Function

Swipe to show menu

Task

Swipe to start coding

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.

The output should be:

My name is {name}
My name is {name}
My name is {name}

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 6. ChapterΒ 3
single

single

some-alt