Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
course content

Course Content

Introduction to JavaScript


To create a new function, use the function keyword. Provide a name for the function and define any arguments it should accept:

The structure of a function definition includes:

  • The function keyword.
  • The function name, typically in camelCase like variables.
  • Arguments enclosed in parentheses ().
  • A code block within curly brackets {}.


Functions have their own data storage space. Arguments are values passed to a function, which the function uses as variables. These arguments cease to exist when the function finishes executing.

To define arguments, assign a name to each one:

If a function accepts multiple arguments, separate them with commas (,).


Arguments are used like variables inside the function's code block.

Function calling

To use a function, call it using parentheses () and provide the necessary arguments if the function expects any:

Everything was clear?

Section 6. Chapter 2