Google's Gary Illyes said that Google Search can process JavaScript redirects but Google still does not recommend using JavaScript redirects because other search engines might not pick up on it.
Gary said on Reddit "it [JavaScript redirects] works on Google, but i see other search engines are having a tougher time picking them up."
The fun thing is, that Google Webmaster Blog uses JavaScript redirects to the new blog location because that was the only redirect option available.
Gary said on Reddit "we used js redirects on webmasters.googleblog.com because that was the only thing we could use for 1:1 redirects, and it works on Google, but i see other search engines are having a tougher time picking them up." "if I have had a choice," Gary said "I wouldn't have used js redirects, ever."
Gary also chimed in this morning on this topic on Twitter:
if my idiotic JS redirects worked just fine on https://t.co/6zWhZNbj28, I'm certain 302s won't do your site much harm either
— Gary 鯨理/경리 Illyes (@methode) February 18, 2021
So if you have a choice, use server side 301 redirects.
Forum discussion at Reddit.