tidderred t1_je1vi30 wrote

(Have read through the first few chapters of Stars and Their Spectra by James Kaler, so most of what I will say is explained in more detail there.)

On the topic of chemical composition of stars, only cool stars, like M dwarfs or L and T type ultra-cool brown dwarfs can have complex molecules survive in their cores. If the star is any hotter (which is the result of a lot of other variables) only pure elements or hardy molecules with strong bonds can survive that chaotic environment without being ripped apart. For example L-T stars can be identified if their chronosphere contains TiO, which is a) a molecule and b) has titanium, which is heavier than sodium or chloride, so somewhere out there NaCl should exist.

But as far as we know L-T stars along with white dwarves and type 0 stars make up about 5% of stars in the universe, so not a lot of NaCl should exist in stars both in quantity and spatial spread.

Like you said, detecting chemicals on exoplanets is much more challenging, where NaCl can exist in greater quantities, without being disturbed by immense heat and pressure stellar cores have. We just cannot know for sure, but it is fun to think about! (Which is a very non-sciency way of saying we should be looking into this.)

EDIT: After an experienced scientist chimed in I realized my answer didn't take into account the fact that the molecule itself needs to radiate some energy for us to detect it, or it should absorb some energy from the envelope to create noticeable dips in the spectrum. In either case, it will heat up, not so much to break the molecule, but not as cold as L-T stars would require (about a few hundred kelvin at most). I also didn't base my speculation on any real detection, just wanted to chime in since what I learned about seemed to coincide with this topic. Still leaving this up in case anyone wants to take this info and go on their own rabbit hole. Also, just saw JWST detected some silicate dust in a what looks to be a hot jupiter (VHS 1256 b), so exoplanets being challenging to study might already be changing with JWST's observations.