An c.ionic bond forms when a cation transfers its extra electron to an anion who needs it.
For example compound magnesium chloride (MgCl₂) has ionic bond (the electrostatic attraction between oppositely charged ions). Magnesium transfers two electrons (became positive cation) to chlorine (became negative anion).