Google Will Not Process Changes to the Meta Robots in JS When the Initial HTML Has a Noindex
https://twitter.comMartin Splitt from Google recently confirmed via a tweet that Google does not process changes to the meta robots from Javascript when the initial HTML has a noindex meta tag. While this is true according to Google, these things can change at any time. So ideally, you don’t want to ever do these things but if it comes up in an SEO quiz you now know the official Google answer.
Also, keep in mind that this is the case when the initial HTML has a noindex, when that is not present you can pass a lot of meta-information via JS and Google will process those eg: JSON-LD structured data markup.