NaCl (Sodium chloride)
NaCl is a ionic compound in which the ions form ionic bond, ionic bond is a chemical bond in which one atom loses one electron to form positive ion and that electron is accepted by other atom to form negative ion.
This depends upon the electronegativity, if the electronegative difference between the two atoms are more then they form ionic bond. [Electronegativity = ability of the atom to pull electron more towards itself]. In NaCl, Cl has more electronegativity than Na thus forming negative ion and since Na loses one electron it form positive ion. Ionic compounds brittle and hard in nature with high melting and boilling points and are highly soluble in water.
CH4 is covalent compound, a covalent compound is formed by covalent bond which is formed by Sharing of pair of electrons between the atoms in a molecule. In covalent bond one attains partial negative charge and another atom attains partial positive charge. Covalent compounds are non electrolyte and poor conductors of heat and electricity, covalent crystals are hard in nature