👨‍💻
Learn to Code
  • Welcome
  • HTML
    • The Basics
    • Getting Started
  • JavaScript
    • The Basics
      • Values
      • Variables
      • Functions
      • Operators
      • Conditional Statements
      • Arrays
      • Loops
    • Intro to the DOM
    • Working with the DOM
    • Activities
      • Text Summariser
        • Getting the words
        • Ranking the sentences
        • Getting the summary
      • Greeter Function
      • Fizz Buzz
      • Temperature Converter
Powered by GitBook
On this page
  • Task:
  • Bonus:

Was this helpful?

  1. JavaScript
  2. Activities

Greeter Function

An introduction to making your own functions

Task:

Make a function which accepts a single argument - a person's name - and uses this name to greet them by printing to the console.

For example, I might expect to use the function like this:

greetByName('Cameron Pavey');
Hello Cameron Pavey, how are you today?

Bonus:

If the name provided is YOUR name, make it give you a special greeting

PreviousGetting the summaryNextFizz Buzz

Last updated 5 years ago

Was this helpful?