This is honestly why I use duckduckgo on any of my dev computers. They don't always have best results, but for stuff like java(script) not only do they have the !js/!java syntax for going straight to the docs but they also don't have over-seo'd websites cluttering up their results.
Edit: Also On DDG the same search would have been !js replace and you would have seen this page : https://developer.mozilla.org/en-US/search?q=replace