0

Of all the cruft in the JavaScript tag, some meaningful percentage is of the typo variety, at least if you define typos slightly more broadly that given in the close reason, to include simple syntax errors and trivial "mental typos".

A great majority of these could be discovered via a simple lint--for example the famous = vs. == problem. Probably 50% or more of them could be solved by opening the console and looking at the errors. Whatever problems remained of the simple-logical-error-brain-fart variety could be easily resolved by some trivial debugging.

I've added comments to dozens if not hundreds of posts reminding people they could lint, or look at the console, or debug. So have others. No small number respond saying they hadn't heard of those things. It's getting really old.

The bottom line is that the vast majority of low-rep users asking lame questions apparently have never bothered to educate themselves about how to open the console or simple debugging approaches and tools, much less use a linter.

I therefore thought to write a canonical question/answer titled "My JavaScript program doesn't work, and I think it might be a typo; how can I find it?", and collect answers there on a different types of typos and ways to find them.

However, reaction has been mixed. I got three "too broad" close votes. One person immediately edited my question to remove all the important information to guide potential answerers into making their answer as useful as possible (view edit history). Another suggested raising this issue in meta, which is what I am doing now.

Is this a bad idea, or a good idea, or an OK idea that needs tweaking?

12
  • 5
    Just a crazy idea: What if the editor automatically detected JavaScript in questions, and used ESLint to check it for syntax errors and common mistakes, and presented a warning to the asker. Probably too complicated, but... Jun 4, 2016 at 17:19
  • 2
    I removed all the irrelevant meta information that had no bearing on the question; the problem was the question, not the edit. There is already a close reason and a downvote button for stupid typos, and plenty of introductory JS tutorials.
    – jonrsharpe
    Jun 4, 2016 at 17:28
  • 1
    Maybe something like this would be more appropriate for the documentation effort.
    – Louis
    Jun 4, 2016 at 17:33
  • @johrsharpe It would really be better if you would hang out in your own tags. If you feel the urge to make such an intrusive edit, raise it here in Meta first and get an opinion there, instead of unilaterally nuking an initiative to improve the situation. The "meta" information had an intimate bearing on the question; it was a guide to how to write useful answers. The point is that I want to do more than just downvote and close typos; I want to help the hapless posters who don't know what to do about them, and no, I don't want to write 100 comments pointing them to a tutorial.
    – user663031
    Jun 4, 2016 at 17:33
  • 2
    @torazaburo if you need a guide to writing answers that isn't the one in the Help Center, the question is not OK. Not that it's any of your business, but just because I have a lot of rep from python doesn't mean I don't know JS (who doesn't, these days?) and more importantly I do know how SO works. And it's perfectly reasonable to be sick of writing comments, so just stop. Helping people who can't even be bothered to run through a tutorial is shovelling the ocean; you're wasting your own time.
    – jonrsharpe
    Jun 4, 2016 at 17:37
  • 2
    What's the point of such a question? Hammering typos as duplicates? The Roomba is nicer on duplicate questions. As such, they won't be deleted if there's an answer already (and the javascript tag suffers a lot from FGITW on typo questions), and not deleted before 30 days in the best case. How is dupe-closing / hammering them to this list question any better, if that's the goal? If not, it doesn't do anyone any more good than RTFM.
    – Kyll
    Jun 4, 2016 at 18:05
  • @Kyll, wasn't planning to hammer typos as duplicates of this question. The main objective was to provide a quick link. With regard to RTFM, the problem is that is there is no FM which tells folks how to debug programs and find these trival problems that they so struggle with.
    – user663031
    Jun 4, 2016 at 18:10
  • @AlexanderO'Mara: Yes, I concur that SO needs to work avoiding such questions being asked in the first place (and a "question wizard" that not only shows likely duplicates but also finds trivial mistakes is a good idea), but that's a different question than what to do with these posts once they exist.
    – Bergi
    Jun 4, 2016 at 18:12
  • 2
    @jonrsharpe Who doesn't know JavaScript these days? To be honest, half the people posting in that tag. :p Jun 4, 2016 at 18:33
  • @AlexanderO'Mara ha, fair point!
    – jonrsharpe
    Jun 4, 2016 at 18:34
  • 2
    @torazaburo In that case, isn't Documentation the solution? That's supposed to be the place for the FM. Since it's supposed to be nicely integrated with SO, it could be used as a nice knowledge base.
    – Kyll
    Jun 4, 2016 at 18:49
  • 2
    I agree with Louis and Kyll that this is exactly the sort of thing that Documentation is designed to help. It's still in its infancy, though, and there's no integration to speak of, yet, either. Typo questions should be closed as off-topic according to the current scope of the site. Once Documentation gets its public release, it may be that we close such questions by linking to Documentation, instead. I haven't been there in a while; have you worked on creating typo-related documentation there yet?
    – TylerH
    Jun 4, 2016 at 21:07

2 Answers 2

7

It's a bad idea. List questions are not a good fit for the Q&A model (see e.g. List questions: Community Wiki?) and if you need that much explanation of how to answer in the question and naked bribery to encourage it (see below), it's a clear sign of an impedance mismatch.

Additionally, the fact that the one answer it did attract before being closed has started a bit of an argument doesn't bode well for the approach as a whole.

About this question

This question is designed to present canonical answers about JavaScript-related typos. We define typos slightly broadly, to include not only spelling mistakes, but also simple syntax errors, and even simple "mental typos".

The goal of this question is that it can be pointed to in comments and answers to questions involving typos as a quick way to help posters track down their typos.

We would like to ask that people answering this question confine each answer to a single type of typo, or a single approach to finding typos. Feel free to provide multiple answers. Give your answer a headline (using # Mistaking = and ==), to make it easier for people to see what your answer is about, and to browse the various answers. It would be best if each answer was as complete and definitive as possible. Take your time and write a good post.

Some examples of ways to find typos which I hope are covered are:

  1. Using the console to view errors.
  2. Using linters.
  3. Standard problem isolation techniques such as "divide and conquer".
  4. Using debugging tools such as Chrome DevTools to walk through code.
  5. Using syntax checking built into your editor.

To promote answers to this question, I (or anyone else that wants to) will be applying rolling bounties of 500 points to the best answers.

This question and its answers will be Community Wiki. That means that upvotes and downvotes will not affect your reputation, and answers can be edited by anyone with a reputation of 100.

2
  • I agree. List questions of the kind "please post an answer for every single thing you can think of" are not a good fit for SO, especially at broad topics (this one is an edge case). However, a single-communitywiki-answer question that is maintained by the community can work well (example).
    – Bergi
    Jun 4, 2016 at 18:09
  • 2
    @Bergi I suspect that the length of a single comprehensive CW answer would support the closure as too broad.
    – jonrsharpe
    Jun 4, 2016 at 18:11
3

The vast majority of low-rep users asking lame questions apparently have never bothered to educate themselves about how to open the console or simple debugging approaches and tools, much less use a linter. They hadn't heard of those things.

I think this a problem that all simple and common programming languages face. They are used in introduction courses, "programming 101", and the questioners simply aren't programmers yet. They are bothered with learning a language, how basic control flow concepts and data structures work. They can't possibly even know what debugging is yet.

The situation is much like in September, and we hardly can stop the flood of programming aspirants.
Not without a global change of mind and a new approach at education or tutorials.

So what can we do with those questions? I think we only can continue with what we already do:

I've added comments to dozens if not hundreds of posts reminding people they could lint, or look at the console, or debug. So have others. It's getting really old.

However, we might be able to close more of these questions rather than answering them. There already is a close reason dedicated at this kind of questions: "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers."

A canonical question might help here, as it would allow gold-badge-holders to wield Mjölnir and close such questions faster. I'm not sure though whether closing as duplicate is helpful here, or whether the more fitting reason should be faster to use.

I therefore thought to write a canonical question/answer titled "My JavaScript program doesn't work, and I think it might be a typo; how can I find it?", and collect answers there on a different types of typos and ways to find them.

Regarding that particular question, I'm not sure how it is different from How can I debug my JavaScript code?. What user would ask "I think it might be a typo"? How would they find out whether it is or is not?

Yes, I agree that we need a good near-tutorial-like question about debugging javascript, with up-to-date answers. I just think that it shouldn't be about typos.

9
  • 1
    The most up voted answer on how can I debug my JS code is completely unacceptable by today's standards. It's just a link: Firebug is one of the most popular tools for this purpose. That's the entire answer.
    – Laurel
    Jun 4, 2016 at 19:12
  • @Laurel: That's true, we'd need to give it some love. Still, wouldn't that post be a better canonical target (and a better question)?
    – Bergi
    Jun 4, 2016 at 19:15
  • Yes I think it would make a good canon. I'm not entirely on board with the "let's fix up the link only answer". I joined this site well after link only was unacceptable, so I would rather earn the rep for myself if I put in the work to earn it.
    – Laurel
    Jun 4, 2016 at 19:26
  • @Laurel: If coordinated by meta, we can a) make all the answers there community-wiki through mod action, b) copy the question to a new post and maintain (new) quality answers there, or c) highjack the old question by adding new answers, downvoting/deleting old ones and dedicating some bounties (as torazaburo intended anyway). The only problem with C is that the community cannot decide on the accepted answer. We'll find a way to make this a good canonical, we just need to decide that the question phrase is the one that's worth it.
    – Bergi
    Jun 4, 2016 at 19:46
  • @Bergi All of your proposals seem fine, although they seem overlook the fact that any new or repurposed or cleaned-up question could be closed by eager beavers for being too broad, as mine was, or would be subject to cowboys removing important content suggesting how to best answer.
    – user663031
    Jun 4, 2016 at 20:07
  • @torazaburo: Any such question should be accompanied by a comment (or small addendum) with a link to the meta discussion (where also the part about how to answer should be - it's meta content, not the question). Any cowboys who act against what the community decided on before then can be dealt with appropriately.
    – Bergi
    Jun 4, 2016 at 20:12
  • 1
    @torazaburo ah, I see; you didn't want to hear other people's opinions or discuss anything, you wanted to be told you were right. Unlucky. This cowboy is riding off into the sunset.
    – jonrsharpe
    Jun 4, 2016 at 20:12
  • @torazaburo: List-style questions are not by definition evil (this one actually turned out successful, but mostly because I wrote every single answer beforehand), but they tend to fail. Just look at the old "How to debug" question - it essentially became a "What tool do you use for debugging" list that is no more useful today.
    – Bergi
    Jun 4, 2016 at 20:19
  • @torazaburo: Sorry, you're right, my answer turned out less constructive than I intended. I kinda answered your question "What do you think about my idea?" and then was waiting for "How would you approach this problem?" - to which we could spell out options, vote on them for a week, and then implement the best (being backed by community consensus). That's how I would go about making new canonicals these days.
    – Bergi
    Jun 4, 2016 at 20:24

You must log in to answer this question.