In this question, we have 3.0 grams of NaCl and we need to know how many moles of salt we actually have, and the best way to do that is by using the molar mass of the salt, which is 58.44g/mol, with both values, we can find the number of moles:
58.44g = 1 mol
3.0g = x moles
x = 0.05 moles of NaCl in 3 grams