Molecules are substances that contain two or more elements, if these elements are different, then the substance is also a compound.
However, considering only the definition of a molecule, it is evident that both CH4 and NaF are molecules as they contain more than one element.