Tutorials

Functions

You could just watch our video here.

Check out the codepen here

But, if you want some explanations, read below.

back to table of contents

short explanation

A function is like a box that does something specific. If you have a TV in your home, it has a remote. The remote has one specific function. To interact with your TV.

If you a xbox game controller, it has one function. Talk to the console, and let you play.

Similarly, in the programming world, a function is a specific box of statements, that handle a specific task.

Look at this function

function anotherfunction(quicknumber)
{
    var logopener="----entering anotherfunction----";
    console.log(logopener);

    console.log("this is coming from anotherfunction");

    console.log("the number that was sent is " + quicknumber);  


    var logcloser="----leaving anotherfunction----";
    console.log(logcloser);
}

A function usually has the following things.

important note

This code is provided as is without any warranties. It’s primarily meant for our own use. Feel free to use this code as it pleases you.

About

Owner and Developer of this project - Jay