What are they?
To answer this, we must go back and ask, why to atoms form molecules? The answer is, they all wish they were noble gases! Noble gases have their outer, or valence, electron shells completely full, which makes them so perfect, they don't need to interact with anything.
In order to try and become more noble, other atoms will try to complete their valence shells. They can do this by sharing electrons with other atoms, which gives you a covalent bond. The other way they can do this is by stealing electrons from other atoms. When one atom steals an electron from another atom, it gains a negative charge, and the victim a positive charge. As you know, opposite charges attract, and so the thief and the victim are stuck together by electrostatic force, and this gives us an ionic compound.