That is a cation can attract more than one anion and visa versa. However, this array has a very specific composition completely dictated by the charges on the cations and anions. Sodium has a positive 1 charge and chloride has a negative 1 charge. 1 Cl 1 or NaCl. The ionic compounds above were made up of monatomic ions.
Molecules can also be ions - polyatomic ions.
The composition of salts with polyatomic ions is determined by the same rule as with monatomic ions.