21

Would it be a welcome addition to Stack Overflow to create a canonical questions about simple data structure manipulation in JavaScript? We get lots of really specific questions like this where it'd be nice to not rehash the same material all the time. Perhaps questions like:

  • How do I convert all values of a JavaScript object into an array?
  • How do I combine all values of a JavaScript array into one value?

...would let us close a lot of questions as duplicates and ideally help new users understand how to think about their problems in more generalized terms.

Side note: I am having a hard time finding guidance on how to create canonical questions. Is that actually a thing or just a regular question intended to be "canonical"?

14
  • 3
    I found that that specific question already had a pretty good dupe. Found it in Google but couldn't find in a Stack Overflow search :P
    – Jacob
    Commented Jul 17, 2018 at 1:07
  • 1
    Well why not, whatever makes the moderating life of a gold badger easier. Truth be told I do not have high hopes that questions will actually get dupe closed all that often, rapid answers will keep coming. I'm also not really sure if that is a good or a bad thing, having canonicals with hundreds of dupes linked to them are not very useful either
    – Gimby
    Commented Jul 17, 2018 at 8:06
  • 3
    Here are some steps to creating a canonical question. (I'm not convinced that it needs to be locked or community wiki - I've seen plenty of "canonical" questions that aren't either.) Commented Jul 17, 2018 at 9:50
  • 1
    @Dukeling it does make sense to do those things given the intentions behind a true canonical.
    – Gimby
    Commented Jul 17, 2018 at 9:59
  • 1
  • 1
    @pnuts It is not without concerns, canonicals can also be too generic and thus start to look like the hammer for all the nails.
    – Gimby
    Commented Jul 17, 2018 at 10:52
  • @pnuts Similar situation, but no. The linked question is actually really focussed: it is about a regular expression, it is specifically to do with a phone number and the requested answers are to involve Javascript. The dupe link is 2/3d part right on the mark. I still wouldn't do the dupe link myself, it is too much of an assumption that the person asking the question knows about the regexreplace function and can be helped by only seeing the regex itself.
    – Gimby
    Commented Jul 17, 2018 at 12:19
  • 3
    @Jacob "Found it in Google but couldn't find in a Stack Overflow search." That's because SO's search is absolutely terrible. I don't think I ever bother with it outside of stuff related to burnination where I need to filter by tag.
    – jpmc26
    Commented Jul 18, 2018 at 2:53
  • 1
    Not unless you can get people to use it. As it is people won't close the obvious ones most of the time.
    – Kevin B
    Commented Jul 18, 2018 at 15:51
  • 2
    Pretty much every question about dealing with arrays in JS have been asked and answered, despite some high-rep users wanting to answer them over and over again: Sum all properties of objects in array, Sum of array object property values in new array of objects in Javascript, From an array of objects, extract value of a property as array, Group array of object nesting some of the keys with specific names, ad nauseum... Commented Jul 18, 2018 at 16:58
  • 3
    Interesting how it's always the same high rep users answering.
    – Kevin B
    Commented Jul 18, 2018 at 18:33
  • The answers change, slowly but they do change. Also, there are usually multiple ways to accomplish something. What about adding a link from each of the dupe questions to "probable best practice" vs "canonical" Commented Jul 18, 2018 at 20:08
  • this is a good idea Commented Jul 18, 2018 at 20:16
  • 1
    What's wrong with the one suggested as an answer to the above meta question? (Access / process (nested) objects, arrays or JSON)
    – Liam
    Commented Jul 19, 2018 at 13:23

0

Browse other questions tagged .