Codecademy

Sign In Create Account
01/05
Fundamental Functions

Functions are the fundamental unit of action in jQuery. The main entry point of most jQuery applications is a block of code that looks like

$('document').ready(function() {
    //do something;
});

An understanding of JavaScript functions will help you to get the most out of jQuery.

There are two ways to define a function but we've been mainly showing you this approach:

var myFunction = function() {
    //do something;
}

We use this method because it is slightly more flexible than the other approach but the differences are not that important.

Write two functions:

  1. sayHello() that returns just "hello"
  2. multiplyThree(x,y,z) which takes three numbers and returns the product of all three of them multiplied together. So multiplyThree(3,5,7) should return 105.
Save & Submit Code Reset Code View Preview
Back to editor
Back to editor
FULL PREVIEW

Start Here

Each lesson starts here. Read the explanation, then follow the instructions underneath. If you get stuck, you can click on the "Hint" for help.

Enter your Code

Type your response to the instructions here, in your code editor.

See What it Does

Here's where you can see how your code will render in your browser. This will update as you type.

Submit!

Ready to see if your code does what it should? Click "Save + Submit" to check your code!

Click "Save + Submit" to run your code! Your code’s output will pop up on the screen.

Sign in to Codecademy