That was a weird example to me. Google, although it ends up returning seo spam like w3schools, usually surfaces good SO answers, which are imo (and I think generally recognized as) the best answers that also contain discussion and caveats, if warranted. It's considered bad practice already to just cut/paste the SO answer unthinkingly. The only thing worse would be to do the same thing with whatever this search engine dragged out of w3schools.
There are lots of criticisms of google search, but in this case, I think the Google result is better - anyone looking regularly for answers is conditioned to tune out the Geeksforgeeks and w3schools and other spam, so as long as good SO answers are from and center, I think google wins