I wouldn't doubt many people click W3Schools results when they see them, they're not that bad, the explanation is straightforward, and it has exercises and a REPL for immediate practice. That reinforces their ranking as useful results.
Conversely, I have no idea why Pinterest plagues everything. Does it manage to trick many people into clicking for a login form?
W3Schools is the prime example that Google does use site authority for its ranking approach. A lot of their content is thin one-liners that don’t explain the subject you’re looking an answer for.