7

I just closed this question for being a direct duplicate of this other question (trying to copy a javascript array using assignment). It got reopened right away. When I commented, Scott Sauyet, who I assume is the user who reopened the question, replied:

The answer there will solve the problem, yes, but there are better solutions to the underlying problem.

OP never asked for a better solution. OP even admitted that their solution wasn't the best one and that they are still learning.

With that in mind, should questions like these be closed as duplicates or left open for a better solution to emerge?

15
  • 6
    I agree, it's a dupe Commented Jun 24, 2020 at 16:43
  • They aren't exact duplicates. The dupe target has a specific point - copying arrays. The closed question asks for a solution where copying arrays is one solution.
    – VLAZ
    Commented Jun 24, 2020 at 16:43
  • Scott has a gold badge in javascript. I'm inclined to give him the benefit of the doubt. Commented Jun 24, 2020 at 16:44
  • 1
    @RobertHarvey So does ibrahim, so that point doesn't hold much weight Commented Jun 24, 2020 at 16:44
  • 6
    Then I guess it's cage match time. Who wants to place bets? Commented Jun 24, 2020 at 16:45
  • 2
    @VLAZ They're asking why it didn't work, it didn't work because the array wasn't copied on the line let unsorted = arr; if they were asking how else to solve it i'd maybe agree, but... they aren't, they're asking why it didn't work Commented Jun 24, 2020 at 16:46
  • 1
    @Nick again, I disagree. The user is asking multiple questions there including "Is this an issue with let? should I be using const instead?" - clearly they are searching for something they aren't sure of. It's clearly asking for an improvement over their current approach in any case. The dupe shows the issue but only a specific way of addressing it, that doesn't cover the all possibilities in this case. I don't think we should be applying the XY problem in reverse and binding the user to a Y solution.
    – VLAZ
    Commented Jun 24, 2020 at 16:53
  • 2
    @VLAZ That's looking at the explicit questions and not the problem identified by the OP: "my unsorted.map is returning a sorted array. I have no idea why." - That is what they want to solve, and they know that Commented Jun 24, 2020 at 16:54
  • 2
    @VLAZ They are asking whether to use let or const on the line of code they are trying to copy the array. They are basically asking whether to use let unsorted = arr; or const unsorted = arr;. Neither will work because that's not how you copy arrays in javascript and the close question solves exactly that. Commented Jun 24, 2020 at 16:55
  • Question closed again, due to the meta effect of posting this here. Nothing more to see. Commented Jun 24, 2020 at 17:20
  • 2
    @RobertHarvey. I'm really out of shape in the Covid shutdown era. So I'm betting on ibrahim in our cage match. Commented Jun 24, 2020 at 18:05
  • 2
    I want to note that although this happened to me once before, I'd forgotten and I actually didn't intend to single-handedly reopen that question. I wanted to vote to reopen it for the exact reasons discussed here. But I was expecting that others would vote and it would be more of a community decision. I'm not sure I like the power to do it alone... Commented Jun 24, 2020 at 18:07
  • 1
    @ScottSauyet you might be interested in this feature request meta.stackoverflow.com/questions/255064/… Commented Jun 24, 2020 at 18:15
  • 1
    Thanks, @Nick. I don't spend much time on Meta, so hadn't seen that. But you're right, I'd be very much in favor of at least having the option of adding my vote to the tally rather than making the decision alone. Commented Jun 24, 2020 at 18:20
  • 1
    The OP got a perfect answer for his usecase, future visitors find the common duplicate. I'd say that's a win win :) Commented Jun 24, 2020 at 20:01

1 Answer 1

3

I'm in the camp that believes that closing a question as a duplicate means that either

  • this question is a clear duplicate of the (presumably well-answered) other one. (In Javascript, where I spend much of my SO time, this might be a pointer to How do I return the response from an asynchronous call? for the many times someone asks a nearly identical question.)

  • the accepted -- or the top-voted -- answer there will answer this question with little ambiguity. (In JS this might be a pointer to How do JavaScript closures work?, which can explain many different behaviors that seem odd to newcomers.)

In other circumstances, I will usually choose not to close them. I do wish there was a reputation level that allowed users to vote against closing question rather than waiting for a close and voting to reopen.

Here the OP was reporting a "Whiteboard problem". Whether that's an actual interview-style code-this-in-front-of-us question or one of the myriad code-and-compete-to-learn sites, I don't know. Either way, I assumed that the OP was trying to learn in this exercise, rather than just solving the immediate practical problem. This was reinforced by:

I use sorting to find the shortest string. (not best practice but hey i'm learning).

But I don't know if making that call is appropriate. I've been around a while and I tend to want to close as a duplicate only when it's really obvious. This is amplified by the OP being very new to SO. But this viewpoint may be counterproductive, and I'd love to hear if it is from those more experienced or those more active in meta.

3
  • But isn't it a clear duplicate, though? OP said in the second paragraph: "But when I try to map the arr later, it remains sorted, even if I set it to a different variable early in the function. Is this an issue with let? should I be using const instead?" If the wording had been a little different, I wouldn't have closed it. Commented Jun 24, 2020 at 18:59
  • Well, we wouldn't be having this conversation unless I disagreed with that! :-) And I still do. I still feel this was a broader question to which the proposed duplicate could only supply a less-useful answer. I was actually in the process of writing my first comment there when the question was closed. And the duplicate didn't seem to fit either of my categories above. I think that's just our different readings of the OP's wording. But I also think you've raised an interesting broader point worth discussing. Commented Jun 24, 2020 at 19:04
  • 1
    The disagreement here is not on when questions are dupes, but on answering what OP asks for vs what they should have asked.
    – Kaiido
    Commented Jun 24, 2020 at 22:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .