I've seen a number of questions where the only code posted is code that functions properly.

On that occasion, there will often be a number of users leaving comments stating (and demonstrating) that the code works properly, but invariably there will be another user who posts an answer that effectively states "Works for me" in so many words, accompanied by a link to a code testing site like jsFiddle.

Are these "Works for me" answers considered valid?

The reason I ask is that I flagged such an answer (now removed), but the flag was immediately declined with...

declined - a moderator reviewed your flag, but found no evidence to support it

  • Does this type of answer to a non-question, or to a question that needs more info, satisfy the requirement of being an "actual" answer, even though it doesn't really do anything to help the user with the problem?
  • Was my flag correctly declined?
  • Hopefully you think this answer is ok :) Jan 13, 2012 at 19:52
  • 4
    @AdamRackis: I'd consider that to be entirely redeemed in that it's very informational, and is a good (and successful) attempt to make something useful out of one of the many non-questions that appear on the site.
    – user176859
    Jan 13, 2012 at 20:01
  • 2
    @AdamRackis: Your answer contains a snippet of code accompanied by a detailed explanation of how the code works, and is not merely "This works for me!" with a link to a Fiddle, which breaks all kinds of rules.
    – user102937
    Jan 13, 2012 at 20:02
  • Thanks. Amusingly, if you had 10K rep, you'd be able to see the three deleted answers attempting to explain why the code was broken :) Jan 13, 2012 at 20:03
  • @Robert - indeed. And I made my comment before I clicked through to see the deleted answer (pretty bad). amNotIam and I have chatted on JavaScript questions before, so I was only being half serious :) Jan 13, 2012 at 20:05

4 Answers 4


Worth noting: The mod who declined the flag is not the same mod who deleted the answer. Like the Precogs in Minority Report, occasionally we do disagree.

  • 1
    Thank you for the info. I was very surprised to see it declined, so I'm glad I asked.
    – user176859
    Jan 13, 2012 at 19:42
  • Oh, I forgot to mention that I like Minority Report even more than I like bullet lists. And that's saying a lot considering that I have to endure Tom Cruise for two hours!
    – user176859
    Jan 13, 2012 at 21:08
  • @animuson: I love the Amanda Show!
    – gen_Eric
    Jan 13, 2012 at 22:46

"Works for me" answers should include details of the environment where it was observed to work.

That means:

  • compiler vendor and version
  • compile options
  • link options
  • operating system
  • CPU architecture

For scripts:

  • interpreter and version
  • operating system
  • working directory
  • CPU architecture

For client-side web stuff, it would mean:

  • web browser and version
  • operating system

And a screenshot or shell transcript showing successful run of the code.

  • 1
    I'd agree with that, but I'd include an explanation of why/how the working code works. I think that if the asker is including working code as an example of a supposed problem, then it would seem clear that the asker doesn't know enough to recognize correct code. In other words, instead of viewing the question as why "doesn't" my code work, it should be viewed as why "does" my code work in order to make these "works for me" answers valid. +1 for the good points though.
    – user176859
    Jan 13, 2012 at 21:47
  • @amnotiam: If the question asks for an explanation, sure. If it's just "Someone told me there's a problem" or "It's causing problems help me find them" then I would assume it was designed by the question asker and they don't need an explanation (or they can ask for one in comments). And often environmental differences explain differing behavior.
    – Ben Voigt
    Jan 13, 2012 at 21:48
  • I think that these questions come from the asker thinking they know enough to reduce their code to a truncated example without the need to test the example. Of course if they knew enough to do that, they wouldn't need to ask in the first place. So many of these are not the actual issue, but are improperly conceived pseudo-examples.
    – user176859
    Jan 13, 2012 at 21:52
  • ...there seems to be a lot of this happening with JavaScript/jQuery type questions, which is where I spend most of my time.
    – user176859
    Jan 13, 2012 at 21:53
  • @amnotiam: In that case, the community should be telling them (1) test it yourself and (2) if it works for you, you are welcome to ask whether that shortcut/trick is portable. And "works for me" is definitely not an appropriate answer to a question about portability, it's inconclusive (OTOH "doesn't work for me" does demonstrate non-portability).
    – Ben Voigt
    Jan 13, 2012 at 21:56
  • Yeah, and that's the problem. Most people comment, but some give a non-answer. If the question is presented as "my code doesn't work", but in reality the example posted does work, some users post an answer that merely says "works for me" (or an equivalent), with a link to a site like jsFiddle. IMO, these are not answers unless the answerer demonstrates in detail that the premise of the question is flawed.
    – user176859
    Jan 13, 2012 at 22:04
  • But none of those details would change the fact that "works for me" either points out a problem with the question or is essentially just a comment about what the answerer has experienced (that's, at best, tangential), instead of providing an answer. An answer to "Why doesn't it work?" starts with "It doesn't work because...", not "But it does work". Jan 8, 2018 at 18:12

The point of an answer is that it should help the OP to solve their problem.

Clearly, "it works for me" does not do this. All it says is that the answerer was unable to reproduce the OP's problem, and gives no insight into how the OP might be able to actually resolve their issue.

If the OP's problem is not reproducible, it usually means that either they haven't accurately represented their problem in their question (e.g. code snippets don't reflect actual code), or they've left out relevant details. In either case, the correct action is to leave a comment asking for additional details, not posting an unhelpful answer.

I'll always flag such answers without mercy or remorse, and I think you were absolutely justified in doing so.

  • +1, though another possible reason not mentioned for failing to reproduce would be an environment difference between the asker and answerer - e.g. different language version, faster PC. Perhaps you're filing that under 'left out relevant details', though.
    – Mark Amery
    Dec 12, 2012 at 20:50
  • But it does help the OP, sometimes a lot; It says "I think there is nothing wrong with your code, look elsewhere". That eliminates a whole class of reasons. Especially for beginners it's often hard to find a solution because so many things can be wrong (IDE, libs, make files, and yes, the code). Excluding the code is a big help. It helps the readers as well, stating "what the OP asks is not a problem (or perhaps rather "not the problem"). Ah, I see that Christophe had the same idea. Jul 11, 2015 at 13:24

I think there's a difference between just saying "works for me" and actually proving that the code is correct.

"works for me" is specific to my environment, there could still be an issue in other conditions (for example a different browser). That's not a complete answer.

Explaining that the posted code is correct is in my opinion a valid answer. It is helpful as:

  1. It tells the OP that it's time to look somewhere else for an issue
  2. It tells the other readers not to waste time looking into the current code, and go help somewhere else
  • 1
    If the question as stated doesn't actually represent a problem, then the question should be closed. The answer may be helpful in the here and now to the OP, but the page as a whole doesn't need to stick around.
    – jscs
    Dec 17, 2013 at 4:56
  • Or fixed with more information so that the actual problem can be seen. Jul 11, 2015 at 13:25

You must log in to answer this question.