Step-by-step explanation:
In HCL, one positive atom is given to chlorine from hydrogen so that it can complete it's octate. chlorine take one electron from hydrogen.
In NaCl, Sodium takes one electron from chlorine to complete its orbit with eight electrons. Chlorine gives one electron to sodium.