# Semicolon for declaring functions in JavaScript

When declaring a function as a Function Declaration, there is no semicolon after the curly brace `}`:

`function func() { console.log('!'); }`

But if the function is declared as a Function Expression, then after `}` a semicolon is placed:

`let func = function() { console.log('!'); };`

Why: because in JavaScript any expression must end with a semicolon, and in this case we just have an expression. This semicolon is optional, since JavaScript generally allows them to be omitted, but it is desirable. Always put :)

Put semicolons in all the necessary places:

`let func1 = function() {console.log('!')} let func2 = function() { console.log('!') } function func3() { console.log('!') }`
←→
↑
en ru