As someone who has changed careers and moved into web development I found w3schools.com did a nice job of complementing MDN as if I was unfamiliar with the concept (or just forgot entirely) w3 was a good "layman's terms" stop just to start. And if I needed a more technical / granular detail, MDN.
I really wouldn't want to use one without the other.
Many years ago I took some C programming classes in college. It was in the early days of the internet and it was very much a "here's the book, a bit of lecture, now sit alone at your computer and do it". MDN can feel that way at times where it's example is ultra specific and while nothing is technically wrong.... it's like learning a language with a dictionary. w3schools.com fills that gap nicely.
At the same time if I need the dictionary to figure out more precisely how something works and all my options, it's MDN all the way.
I like them. MDN is great, but w3schools is better in giving examples on how to use stuff.
W3schools were so bad, essentially just a click farm promoting any old crap for the pageview, that it'll take a huge amount of correcting, improving, and newly found ethical standards to let me forgive them. Or forget there really was a need for w3fools. They always gave lots of examples, and they were often simply wrong.
Even when they apparently have the answer, until I can validate it on SO or some other place, I'll tend to not trusting...
<p>see the Console API</p>
<footer>don't use alert(), don't talk about alert(), don't teach alert(), it's not 1997 anymore</footer>
You just have to give proper context.
If you're teaching, teach people to use console.log because that's where they're going to get REAL insight into what the code's doing (console.table you say? amazing!) and never look back. And if you're learning, demand people teach you modern practices. Not ridiculous things from 20 years ago.
That's not 'tests' — tests would be something like Mocha, or Jasmine — what you're actually talking about here is one of the many forms of ad hoc in-browser debugging.
Ah, if only there was a single word - a verb perhaps - that developers could use to colloquially refer to this process!
There is still some complete nonsense on w3schools. For example, I wanted to know recently whether Python supports arrays. The first result on Google is this page: https://www.w3schools.com/python/python_arrays.asp
There is a small disclaimer at the top stating: "Note: Python does not have built-in support for Arrays, but Python Lists can be used instead."
Why the fuck is your page called "Python Arrays" if you don't plan to talk about arrays?
Then the rest of the page talks about lists, while erroneously calling them arrays, in complete defiance of the disclaimer. I imagine what happened is that someone who doesn't know what an array is wrote the page originally, then someone else came by later and realized it was wrong, but instead of actually fixing it, slapped that half-assed disclaimer on top.
I still don't know whether stock Python actually supports arrays. I ended up just importing Numpy.
that w3schools page is indeed nonsense. They should probably stick to JS.
While the Python 3 docs for arrays certainly do lean on the type-constraint, I notice it also has the various operations that imply a contiguous buffer (cast to bytes, etc.), so I wonder if that's not the real distinction and the type constraint serves that.
Traditional Python lists are much closer to what I know as a vector: indexable like an array, but dynamically expandable and usually implemented as a list of references to data structures instead of containing the data itself so allows for heterogenous data.
Informally, I've certainly called both types of things arrays, right or wrong, and rarely call anything a vector other than container classes by that name, but I do suspect that's what your parent comment is drilling on.
* Then there's the JS Array class, which acts more like a vector than array by those definitions, so who knows.
If they are, then the article is even worse, as the disclaimer that Python doesn't have arrays is a lie!
That's a pattern of the language and why I don't like it: It's very often almost like the other C-like languages, only to be that much different that it gets confusing. To just ignore that and call a list an array is not correct, but it makes the beginner searching how to do array-like stuff in python succeed in his task.
I'd be more annoyed at that page if they didn't explain the situation, but they do.
Actually, they don't. The article claims that arrays don't exist, but you can use lists instead.
Apparently the polar opposite is true: lists don't exist, but you can use arrays instead! (And they're called "lists" for whatever reason).
But python also has an array module you can use after an import, it's not loaded by default. That data structure behaves even more like the thing C calls an array.
I don't see why a python list is not a list per se. Don't be confused by the others explaining it is not a linked list - something does not have to be a linked list to be a list. It's still a numbered collection of stuff that can be sorted, thus a list.
Though it is true that as a programmer you probably are first confronted with a data structure called list when you learn a LISP, and that data structure will be a linked list.
Confronting beginners with all this is not useful for them, w3schools just adding a note and calling the python default collection thing an array is thus not that unreasonable. Though I'd prefer it if they just called it a list in the explanation below the note, after explaining that this list structure is what you are probably searching, with a link "look there for what python calls an array". So in that way I agree with you, this is not optimal.
One of the useful definitions of an array is that it guarantees contiguous storage in memory. In Python, there is no way to guarantee that; even if a list is a C array of Python references under the hood, there's no way to store the information represented by those references contiguously in memory. From that perspective, pure Python doesn't have any arrays at all, which is precisely why the popular NumPy has to offer explicit support for numeric arrays.
From another perspective, arrays are a set of O() guarantees for various operations. From that perspective, Python lists will generally meet the specifications that you'd write for a resizable array, or perhaps what you might call "vector", depending. CPython comes with some awful constant factors but the O() of the lists will be what you'd expect.
Rather than arguing about whether Python has "arrays" interminably, it's better to carefully define array, then dispassionately examine Python lists to see if they match that definiton. You'll get a yes sometimes and no others. I say "dispassionately" because too many people seem to assign moral qualities to whether or not something conforms to a given definition, but that's not a path to understanding. No matter what definition you write down for "array", not a single characteristic of Python will change.
I have literally never seen or heard of a definition of array according to which lists are arrays -- can you cite one?
By the only universal definition I can think of, python lists are arrays.
Python lists most certainly meet the mathematical definition of array (ie name by index)
That makes my point even stronger. The article about "Python Arrays" directly claims that Python Arrays don't exist, which is apparently wrong!
The whole point is that I came away from the article believing information that is false.
Same as how a hashtable is used to implement a mapping.
The whole point of my comment is that I went away from the article still not knowing whether Python has arrays, or not. I can't understand how anyone would defend an article called "X" that doesn't even properly inform you whether X exists
If a programmer from another language asks for an array, I'm going to point them at the `list` class in Python.
As some other sub-comments under your original post note, some uses of an array want the actual data to be contiguous. But Python `list`'s values are references to other values, not the direct values themselves. If you're familiar w/ C, it's closer to an array of pointers to objects. That matters for some niche cases. But in basic tutorial? No. And Python has some built-in types to account for some of the niche cases. Sure, that pointer is not free, and the overhead of a Python object is not free, but Python is a high level scripting language, and generally, `list` provides a random-access ordered collection, which is what most people want when they say "array", and the overhead doesn't matter for many things.
An optimizing Python doing escape analysis could see a list was going to be converted to a set and swap in a set and change the method calls. Or it could see a large number of concatenations and use a linked list as an intermediate form.
Of course improvement without expectation of reward shows a higher moral stature, but it is a stature that is perhaps not to be expected, whereas improvement based on reward seems more likely to exist in our world - given studies of the matter.
"Today, W3Schools has largely resolved these issues and addressed the majority of the undersigned developers' concerns. For many beginners, W3Schools has structured tutorials and playgrounds that offer a decent learning experience. Do keep in mind: a more complete education will certainly include MDN and other reputable resources."
The MDN doc allows you to run the code there and then - no jumping around to a "Try it yourself" page. Also, MDN gets to the syntax quickly - with w3schools, I have to search for the syntax in amongst a bunch of other junk that I really don't care about at that moment (like browser compatibility).
To a seasoned dev, MDN feels clear, w3s feels like a confusing mess. Maybe for early stage devs it's the other way round?
If I need the finer details and understand what i'm looking up, straight to MDN.
If I'm in over my head and want a bit more context, back up to w3.
And then sometimes back to MDN ;)
If you actually read the docs on MDN, you can write stuff that actually work instead of copying random snippets of code until it does what you want to do.
Seeing that many developers (including experienced professionals) thought the two entities were related, it seems obvious that they directly benefited from that confusion. Luckily this seems less relevant now that WHAT WG exists separately from W3C and ECMA/TC39 is more prominent.
 Just checked. Twenty years!
But it is pretty natural in how language works for people to see similar names and assume an association. And you can't reconsider an unconscious association, since it's unconcious.
I wonder how many folks using w3schools.com really know who w3.org really is ;)
W3schools is better when it comes to HTML+CSS with JS sprinkled on top questions IMHO.
MDN for the specifics.
My Stack Overflow post history contains three mentions of W3Schools, all of which involve W3Schools making an error:
* https://stackoverflow.com/q/20610930/1709587, about W3Schools stating falsely that it's necessary to explicitly add `type="submit"` to submit buttons in HTML to ensure cross-browser compatibility.
* https://stackoverflow.com/a/52355253/1709587, in which W3Schools makes false claims about the `colspan` attribute - both about what the specs say about it, and about how browsers implement it.
None of these things are fixed. The fact that they tidied up the specific errors that the W3Fools team listed, in response to the biggest ever hostile PR campaign that W3Schools ever faced, does not mean that they are now a decent, error-free source. Far from it.
I'm pretty serious about web development, and yet I constantly find myself mildly frustrated with whatever MDN resource I find when I'm looking for a solution to my problem.
If I had to guess why I get frustrated, it's probably because MDN seems to focus on being a comprehensive reference at the expense of offering examples and solutions to those who don't immediately care about the nitty gritty.
I think fetch() is a perfect example of this. Back when I googled how to use it, I ended up on MDN and it wasn't too helpful. I had to scroll down and click on another link to get an example, and while that example was for JSON, it immediately made it clear where I should look if I'm dealing with some other kind of response.
Not that W3Schools is better. It sends me here: https://www.w3schools.com/js/js_ajax_examples.asp
But what I'm really missing here is a php.net style website that gives me some concrete examples that solve the most common use-cases, and either offers more in-depth material if I want to properly understand it, or references MDN. I totally understand how for many situations W3Schools is that resource.
Fundamentally, W3Schools is a content mill for technical material, and they prioritize SEO over accuracy.
1. These problems caused actual confusion for real developers doing ordinary web development work. One of the linked questions has hundreds of thousands of views.
2. You suggest I'm being a pedantic dick to people who are "helping others", but W3Schools doesn't help anyone - at least compared to the counterfactual of them not existing. It would hypothetically be right to say "okay, they have errors, but they're better than nothing" if the realistic alternative was "nothing". But the realistic alternative is that MDN would rise to the top of search results. The complaints about W3Schools' accuracy come in the context of them having skillfully SEOed their content above basically everything else, including huge amounts of not-for-profit content that is vastly superior to theirs. That does cause their very existence to do damage to the world, and make them worthy targets of criticism.
3. Remedying the point about the behaviour of colspan in real browsers being misdocumented doesn't require W3Schools to "write a novel" about anything. It just requires to them to remove content they've included which is false.
In the second post https://stackoverflow.com/a/52355253/1709587, W3Schools gave you the information litterally from teh HTML4 spec. It's hardly W3's fault that it wasn't followed as designd. This is the type of pedantic nit-picking bullshit i'm talking about.
And on your third link, I checked the W3Schools page and it literally says "Note: Only Firefox supports colspan="0",..." Contrary to what is in your StackOverlflow post, I assume you only read the Attribute Values and not the whole page. Blaming W3Schools for your lack of reading comprehension is shameful.
I should probably go back to the first two questions and see what else you just didn't read, but were quick to blame they didn't have the "right answer". People just need to learn to read, imho.
Note that W3Schools is not the W3, and have no official affiliation.
> They are dumb because it really makes no difference. ... getting butt hurt because of a "Tip"
It does make a difference. If that tip had been true, it would mean I'd been writing HTML that only worked in a subset of browsers the whole time, and I would've needed to go over all HTML forms I'd ever written and correct them to ensure browser compatibility, and educate my colleagues who also left off the attribute. Are you suggesting that I should read something like that, that if true would mean that all the forms I've written are broken, and just ignore it? Or blindly trust it, and demand that my colleagues change their code style on the basis of an unsubstantiated "tip"? What was I meant to do other than dig deeper to try to find out the truth?
> W3Schools gave you the information litterally from teh HTML4 spec
Yes. Which has been obsolete for years, and yet their page isn't updated.
> I checked the W3Schools page and it literally says "Note: Only Firefox supports colspan="0",..." Contrary to what is in your StackOverlflow post
I literally quote the same passage in my post and note, explicitly, that it is untrue. Firefox's behaviour is just like all the other browsers.
Also, a moment ago you were berating me for taking an aside seriously. Now you're also berating for not scrutinising every aside for caveats that contradict the main documentation? It's unclear that there's any approach to reading W3Schools that will satisfy you, other than magically divining the truth from their docs even when what they write is wrong.
> People just need to learn to read
Today, W3Schools has largely resolved these issues and addressed the majority of the undersigned developers' concerns. For many beginners, W3Schools has structured tutorials and playgrounds that offer a decent learning experience. Do keep in mind: a more complete education will certainly include MDN and other reputable resources.
I personally stopped visiting w3schools when I started finding more answers that were simply wrong than ones that were right.
Glad to hear that it has improved since then, though.
Google insists on having my information so they can "serve me content tailored to my wishes". Well, Google ... drop the w3schools already!
I Google loads of stuff each day. I want to drop w3schools from all my results, automatically.
p.s. I mostly learnt how to do that on w3schools. :-)
If you wanted to exclude example.com just add
Makes me wonder if that’s built into the ranking algo some how.
W3schools may have questionable content. It may have content that is not trendy or latest/greatest. The security concerns are important, but if we're really being honest with ourselves most of the vitriol is pedantic superiority complex attitude that permeates tech conversation.
I learned PHP in high school from w3schools. I don't use it now; I use the PHP docs. I learned how to host an HTML site from w3schools; now I reference Apache docs because I know what even a webserver is. I once got a CD from McDonalds that kickstarted me being a lifelong fan of one of my favorite artists. I'm sure all of the "hardcore" fans would look down on me for that too.
Anyone serious about web dev pulls for multiple sources all of the time; probably from w3schools and mdn at the same time. People grow. Sites like this are important, although imperfect.
vim.dev redirection is eval
jQuery is not sexy or modern, but w3school's supposed tutorials are ancient, teach bad practices (find me an XHR example that doesn't use ready State), and work objectively less well than their framework (or modern JS) counterparts. For the market they're serving, they're leading to _worse_ software being built.
> find me an XHR example that doesn't use ready State
I absolutely see no problem with using readystate.
> and work objectively less well than their framework (or modern JS) counterparts
Come on, that's silly. What's called modern JS and what those super heavy framework use are in no way objectively better. To confront beginners with all their overhead (build tools for JS! Just crazy) is in no way helpful.
We have a load event now. Ready state is the legacy cruft left behind by Microsoft a decade ago. Let's not confuse new devs with magic numbers and convoluted events that are often cargo-culted incorrectly.
> To confront beginners with all their overhead (build tools for JS! Just crazy) is in no way helpful.
People have been dropping a jQuery CDN script tag on their pages since well before most build tools were invented. W3schools has _multiple_ "tutorials" that could be replaced with $('...').load('...').
It's rich when HN complains about websites that do things like break middle click and browser history and lack error states, but then advocate for trash code like w3schools peddles that makes these bad practices more common.
Like the page literally, have a screenshot of a old school OS alert box?
1) meaning w3schools not the w3fools parody site
People who have a hate hardon for w3schools are the kind of people who will judge you for the kind of dish soap you use.
I'm certain w3schools will claim the domain in short order.