Functions

Let's craete our own function!
We're now completing our work in Submlime and the console.

This function has been added to the page:

    var multiplication = function(x, y) {
        var total = x * y;
        return total;
    }
  1. Use the multiplication function I created to multiply two numbers.
    • Hint: multiplication(x, y);
  2. Open the 006-functions.html file in Sublime Text. Create a new function, and assign it to a variable named fullName.
    • Hint: Look for the comment "WRITE YOUR FUNCTION HERE" to find out where you should add your code.
  3. Add two paramaters to your function - firstName and lastName.
  4. Inside your function, create the variable name.
  5. Assign the value of name to the contenation of your two parameters - firstName and lastName.
    • Hint: You concatenation operator is the plus sign (+).
  6. Inside your function, return the variable name.
  7. Save the 006-functions.html file and refresh this page in your browser.
  8. Use your fullName() function to print out your name.

Extra Credit

  1. If you didn't add a space between your firstName and lastName parameters, edit your function to format your name with a space.