I'm lazy so i'll just link some good article on this topic.
It is also pretty well described over w3schools.