Function Basics

You've already seen the power of for loop in CodeCraft world, you will be amazed after you understand functions.

A JavaScript function is a block of code designed to perform a particular task. In other words, functions are chunks of code that can be reused.

So far you've already seen quite a few JS functions such as console.log(), game.setBlock().

We have some basic understanding of functions:

Every function has a name, followed by parenthesis ( ). Any input parameters or arguments should be placed within these parenthesis. Some functions don't have input arguments so the parenthesis are empty.

In order to use the function, we just need to call the function name and provide the required argument values.

results matching ""

    No results matching ""