You do not need to declare variables before using them. But it is not good practise.
You can force variable declaration using "use strict" statement at the beginning of the script.
Variables can be declared using 3 ways
var - Variable has function scope and it is hoisted. Variables created
without the keyword var have global scope even if they are created inside a function.
let - Variable has block scope and it is not hoisted
const - similar to Const. Const variables can be assigned only once
You can find the type of any variable using typeof operator.
Here is the list of primitive data types