John Mueller from Google advises placing JavaScript code underneath the HTML element to ensure that search engines can clearly understand your website.
You Might Also Like
Accessibility Tools
Font Size
High Contrast
Text Spacing
Dyslexia Friendly
Highlight Links