Functions
Explore how to define and call functions in JavaScript, understand function scope and variables, and create reusable code blocks. This lesson helps you grasp fundamental function concepts and practice returning values based on inputs.
The concept of function
Think of a function like a mathematical function giving you a relationship between input and output variables. If you don’t like maths, think of a function like a vending machine. You give it some coins and a number, and it spits out some cold coke.
This function definition describes the relationship between its input variables a and b and the return value of the function.
The return statement returns the ...