Here's why:
* Ionic compounds are formed by the electrostatic attraction between positively charged ions (cations) and negatively charged ions (anions).
* Sodium (Na) loses an electron to become a positively charged ion (Na+).
* Chlorine (Cl) gains an electron to become a negatively charged ion (Cl-).
* These oppositely charged ions attract each other strongly, forming the ionic compound sodium chloride.