The difference between these two types of compounds lies in their electron bonding structure. Whereas the constituents of IONIC compounds essentially donate electrons and accept electrons, COVALENT compounds share their electrons!
To find molar mass, one must look to The Periodic Table of Elements for the ultimate answer.
The process to find the molar mass of both IONIC and COVALENT compounds is the same, detailed below.
-------------------
Let's take an IONIC compound first, NaCl, known as Sodium Chloride, and more commonly as table salt.
Na - Sodium - molar mass as denoted by periodic table = 22.99
Cl - Chlorine - molar mass as denoted by periodic table = 35.45
Now, we have both constituent molar masses. For this particular IONIC compound, no subscripts are present, which means we only have 1 of each constituent in our formula. Thus, simply adding the molar masses of each constituent will lead to your answer!
22.99 + 35.45 = 58.44 g/mol NaCl
----------------------------
Next, we will look at a COVALENT compound.
Let's take CO2, or Carbon Dioxide.
Here, we do have a subscript (the small 2 beside the O in our formula for CO2.)
This means we will account for the molar mass of O twice, because the molar formula calls for 2 Os!
C - Carbon - molar mass as denoted by periodic table = 12.01
O- Oxygen - molar mass as denoted by periodic table = 15.99
Simply add one molar mass equivalent of C (12.01) and two molar mass equivalents of O (15.99 * 2).
12.01 + 15.99 + 15.99 = 43.99 g/mol CO2
I hope this was helpful!