bhylu.com

Advertisements

Function Intro

A function body contains work that runs when the function is called. Parameters receive values from the call.

Where to run this

This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.

A practical example

JavaScript

function greet(name) {
  return "Hello, " + name;
}
console.log(greet("Mira"));

What happens

The returned greeting is printed.