Nobody is arguing that we should be taking snippets and examples verbatim and use them 100% of the time without understanding them, just that there is value in having those snippets and examples available.
I know damn well how arrays work in javascript, from how they are implemented and what structures they use in memory at smaller sizes all the way up to the difference between a missing element in a sparse array to a dense array with an undefined value in it.
But sometimes I just want the snippet from MDN that "densifies" a sparse array. I know how it works, I can re-write it myself if needed, but I know that the one on MDN works and I won't hit any unexpected edge case because I forgot about some arcane bullshit thing.
Not to mention that when I'm first learning a new language or syntax I personally do MUCH better seeing examples of the code and being able to step through them to get the basics down (where I can then dive deeper into the system to understand the edge cases, hopefully with examples themselves to make sure I get the point).
MDN is a wiki. People who want to contribute documentation or examples do so. Sometimes they make mistakes. Sometimes they're suffering from Dunning-Kruger. It is unreasonable to assume that the example will work and will not have unexpected edge cases.
It's the best resource I know on the web, which is I recommend it, and why I've contributed to it, but it's a wiki. Caveat emptor. (Caveat lector?)
There's a lot of technology to understand and absorb, and I'll take any tool I can get to help me.
I find one of the first things I do when approaching non-trivial new features is to sketch out an example and then step through the example by adding a few strategically placed breakpoints. The breakpoints allow me to examine both the execution flow and the internal state of the various objects associated with the new feature.
Both Chrome and FF support the handy 'debugger' statement, which you can place directly in your code and which acts as a breakpoint when you run the code with devtools open.
Edit: Apparently the debugger statement is standardized! Neat. Didn't realize that. Thanks MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
I'd like relevant examples. It's incredibly frustrating to look at an MDN snippet to see code that no sane human would ever write. Self-executing closures that return callbacks inside for-in loops, initialization code that still checks readyState, code that avoids more than one function for no obvious reason...MDN can be a real crap-shoot. Hell, I'd be happy if they would name their variables sensible things instead of trash like `numFoo`.
TBH, that's why actual documentation is there. Examples can never really cover everything something can [or cannot] do.