Function

A function is a named group of statements in a program that performs a task when it is invoked. Other programming languages make a distinction between a function, which returns a value, and a procedure, which performs some operation but does not return a value. Since JavaScript does not make this distinction, you can create […]

A function is a named group of statements in a program that performs a task when it is invoked.

Other programming languages make a distinction between a function, which returns a value, and a procedure, which performs some operation but does not return a value. Since JavaScript does not make this distinction, you can create functions that return values elsewhere in your code.