[Tutorial] Javascript Basics

Before we use a function, we need to define it. The most common way to define a function in JavaScript is by using the function keyword, followed by a unique function name, a list of parameters (that might be empty), and a statement block surrounded by curly braces. function functionName(parameters) { code to be executed } Function Expressions A JavaScript function can also be defined using an expression. »