Afunctionis a code snippet that can be called by other code or by itself, or avariablethat refers to the function. When a function is called,argumentsare passed to the function as input, and the function can optionally return a value. A function inJavaScriptis also anobject.