How do you make a ionic compound?
Electrons are transferred from a metal to a nonmetal.
Ionic bonding is the complete transfer of valence electron(s) between atoms. It is a type of chemical bond that generates two oppositely charged ions.
In ionic bonds, the metal loses electrons to become a positively charged cation, whereas the nonmetal accepts those electrons to become a negatively charged anion.
Taken from here.
Look at the image. Sodium has 1 electron in its outer shell. To become stable, it needs to lose that electron. Chlorine has a shortage of 1 electron to become stable.
When the transfer of the electron is complete, the sodium forms a cation and chlorine becomes an anion.
Good Luck :)