The correct option is B By forming ionic bond
An ionic bond is formed in a molecule when one atom in the molecule transfers one or more electrons from itself to its neighbouring atom in the molecule.
In this molecule, calcium transfers its two electrons to its two neighbouring chlorine atoms and hence CaCl2 is an ionic compound.