When table salt, which is chemically sodium chloride is added to water, the salt readily dissolves in the water. Sodium chloride being an ionic compound ionizes into sodium ion, Na
and chloride, Cl
.Sodium has an atomic number 11 and chlorine has an atomic number of 17.
Na-(2,8,1) can readily lose the outermost electron in order get a stable octet configuration on the valence shell. So, sodium forms a cation
Cl-(2,8,7) accepts an electron to complete the octet. So, chlorine forms an anion.

Sodium will form a cation and chlorine an anion when NaCl is dissolved in water.