Working with javascript functions?

Example:


  function greet(name) {
      return "Hello, " + name + "!";
  }
  console.log(greet("Alice"));  // Outputs: Hello, Alice!
  

Solution:

Functions in JavaScript are blocks of reusable code. They are defined using the function keyword, followed by a name and a set of parentheses.

Beginner's Guide to JavaScript