Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
32 lines (24 loc) · 972 Bytes

File metadata and controls

32 lines (24 loc) · 972 Bytes
Copy raw file
Download raw file
Outline
Edit and raw actions

Function call

Use a function by its name somewhere in a program.

function doSomething(){}
doSomething();

If you've made a function in your program, it can work as a block in other parts of your program. To use your function you make a function call. This is like calling a friend for help. The function has code inside of it that will do something to help your other code. So, you call your function for help to get something done now. Like this:

let side = 0;
let volume = 0;
function cubeit() {
    volume = side * side * side;
}

side = 15;
cubeit();
side = 21;
cubeit();

In the example, the cubeit function is called twice to calculate the volume of some cubes with different sizes. The code in the function stays in one place. It doesn't have to get copied to the program everyplace you want to calculate a cube volume. This is really convenient! Your code is reusable.

See also #seealso

define

Morty Proxy This is a proxified and sanitized view of the page, visit original site.