Ions produced by metals in Groups 1 and 2 and by non-metals in Groups 6 and 7 gain full outer shell of electrons, so they have the same electronic structure as a noble gas (Group 0 element)
When metals react with non-metals, electrons are transferred from the metal atoms to the non-metal atoms, forming oppositely charged ions that are strongly attracted to each other
Ionic compounds don't conduct electricity when solid because the ions are all held in fixed positions. However, when they're melted or dissolved, the ions are free to move and they'll carry electric charge.
A pair of electrons is shared between two atoms. Atoms share electrons with each other to get full outer shells (highest energy levels). They only share electrons in their outer shells and both atoms involved in the bond end up with one extra electron in their outer shell. The positively charged nuclei of the bonded atoms are attracted to the shared pair of electrons by electrostatic forces, making covalent bonds very strong.
Chlorine atoms need one more electron to gain a stable electronic structure. So, two chlorine atoms each share one of their electrons to form a chlorine molecule containing one shared pair of electrons - a single covalent bond.