Write Reusable JavaScript with Functions

In JavaScript, we can divide up our code into reusable parts called functions.

Here's an example of a function:

function functionName() {
  console.log("Hello World");
}

You can call or invoke this function by using its name followed by parentheses, like this: functionName(); Each time the function is called it will print out the message Hello World on the dev console. All of the code between the curly braces will be executed every time the function is called.


  1. Create a function called reusableFunction which prints the string Hi World to the dev console.
  2. Call the function.

Tests

  • Waiting: 1. reusableFunction should be a function.
  • Waiting: 2. If reusableFunction is called, it should output the string Hi World to the console.
  • Waiting: 3. You should call reusableFunction once it is defined.
/**
* Your test output will go here
*/