A sodium atom has the electron configuration of [ 2,8,1 ] before bonding with a chlorine atom which has the electron configuration of [ 2,8,7 ].
because sodium becomes a one plus ion ( +1 ), it must lose an electron to become stable therefore when bonded the electron configuration becomes [ 2,8 ] this is the same as the noble gas, Neon [ 2,8 ].
because chlorine becomes a minus one ion ( -1 ), it must gain an electron to become stable therefore when boded the electron configuration becomes [ 2,8,8 ] this is the same as the noble gas, Argon [ 2,8,8 ].