pushing a string into array return a number and not the actual string?

I am trying pushing the name but in the console log I see just a number and not the actual name

What am i doing wrong??

const cartItems = [{
    id: 1,
    name: "Soup",
    price: 3,
    category: "starters",
    count: 1
  },
  {
    id: 2,
    name: "Pâté",
    price: 5,
    category: "starters",
    count: 1
  },
  {
    id: 9,
    name: "Sticky toffee",
    price: 18,
    category: "desserts",
    count: 1
  }
]


var dishesArray = [];
var groupByCategory = []
cartItems.reduce(function(res, value) {
  if (!res[value.category]) {
    res[value.category] = {
      category: value.category,
      count: 0,
      dishes: dishesArray.push(value.name), // problem here
    };
    groupByCategory.push(res[value.category]);
  }
  res[value.category].count += value.count;
  return res;
}, {});

console.log(groupByCategory)

Expected output

[{category: "starters", count: 2, dishes:["Soup","Pâté"]},
 {category: "desserts", count: 1, dishes:["Sticky toffee"]}]

172 thoughts on “pushing a string into array return a number and not the actual string?”

  1. I’ve been exploring for a little bit for any high-quality articles or weblog
    posts in this kind of house . Exploring in Yahoo I finally stumbled upon this site.
    Studying this information So i’m satisfied to exhibit that I’ve an incredibly good uncanny feeling I discovered just what I
    needed. I so much indubitably will make certain to don?t forget this website and provides it a glance on a constant basis. http://droga5.net/

    Reply
  2. Howdy just wanted to give you a quick heads up.
    The words in your article seem to be running off the screen in Safari.
    I’m not sure if this is a format issue or something to do with web browser compatibility
    but I figured I’d post to let you know. The layout look great
    though! Hope you get the problem resolved soon. Kudos http://ciaalis2u.com/

    Reply
  3. Attractive section of content. I just stumbled upon your site and
    in accession capital to assert that I get in fact enjoyed account
    your blog posts. Any way I’ll be subscribing to your feeds and even I achievement you access consistently quickly.

    Reply
  4. Howdy excellent blog! Does running a blog such as this take a lot of work?
    I have no expertise in coding but I was hoping to start my own blog soon. Anyway, should you have any recommendations
    or tips for new blog owners please share.
    I know this is off subject but I just needed to ask.
    Kudos!

    Reply
  5. I think this is one of the most important information for me.
    And i’m glad reading your article. But want to remark on few
    general things, The web site style is perfect, the articles is really nice :
    D. Good job, cheers

    Reply
  6. Hello, Neat post. There’s a problem together with your
    site in internet explorer, may check this? IE nonetheless is the market leader and a huge component of folks will
    pass over your excellent writing due to this problem.

    Reply
  7. each time i used to read smaller articles or reviews which as well clear their motive,
    and that is also happening with this article which I am reading at this
    time.

    Reply
  8. Hello! I know this is somewhat off topic but I was wondering if you knew where I could get a captcha plugin for my comment
    form? I’m using the same blog platform as yours and I’m having problems finding one?
    Thanks a lot!

    Reply
  9. At this time it looks like Movable Type is the top blogging
    platform out there right now. (from what I’ve read) Is that what you’re using on your blog?

    Reply
  10. Everything is very open with a clear description of the challenges.

    It was really informative. Your site is extremely
    helpful. Thank you for sharing!

    Reply
  11. Right now it sounds like WordPress is the best blogging platform available right now.
    (from what I’ve read) Is that what you are using on your blog?

    Reply
  12. When someone writes an post he/she retains the image of a user in his/her
    brain that how a user can know it. Therefore that’s why this piece of writing is outstdanding.
    Thanks!

    Reply
  13. I blog frequently and I seriously appreciate your content.

    This great article has really peaked my interest.
    I am going to bookmark your website and keep checking for
    new information about once per week. I opted in for your RSS feed
    as well.

    Reply
  14. When someone writes an piece of writing he/she keeps the image of a user in his/her
    mind that how a user can be aware of it. Thus that’s
    why this post is outstdanding. Thanks!

    Reply
  15. Whats up very cool blog!! Man .. Beautiful ..

    Superb .. I will bookmark your web site and take the feeds also?

    I’m happy to search out numerous useful information here in the put up, we’d like develop
    extra strategies in this regard, thanks for sharing.
    . . . . .

    Reply
  16. Spot on with this write-up, I truly think this amazing site needs a lot more attention. I’ll probably be back again to read through more, thanks for the information!

    Reply
  17. Helpful info. Lucky me I discovered your web site by chance,
    and I’m shocked why this accident did not took place in advance!
    I bookmarked it.

    Reply
  18. It is the best time to make some plans for the longer term
    and it’s time to be happy. I’ve read this post and if I may I want to counsel you
    few fascinating things or suggestions. Maybe you can write
    next articles regarding this article. I want to read more
    issues approximately it!

    Reply
  19. Undeniably believe that which you stated. Your
    favorite justification seemed to be on the net the
    easiest thing to be aware of. I say to you, I certainly get annoyed while people think about worries
    that they plainly do not know about. You managed to hit the nail upon the top
    and defined out the whole thing without having side effect , people
    could take a signal. Will likely be back to get more.
    Thanks

    Reply
  20. What’s up everybody, here every one is sharing these kinds of know-how,
    so it’s pleasant to read this blog, and I used to go to see this weblog all the time.

    Reply
  21. Excellent post. I was checking constantly this blog and I am impressed!
    Very helpful information specifically the last part 🙂
    I care for such info a lot. I was seeking this particular
    info for a very long time. Thank you and best of luck.

    Reply
  22. Hmm it seems like your blog ate my first comment (it was super long)
    so I guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your
    blog. I as well am an aspiring blog blogger but I’m still new to the whole
    thing. Do you have any helpful hints for newbie blog writers?
    I’d genuinely appreciate it.

    Reply
  23. I am really impressed with your writing skills and also
    with the layout on your blog. Is this a paid theme or did you customize it
    yourself? Anyway keep up the nice quality writing, it is rare to see a nice blog like this one these days.

    Reply
  24. Hey there! I’m at work surfing around your blog from my new iphone 4!
    Just wanted to say I love reading your blog
    and look forward to all your posts! Keep
    up the outstanding work!

    Reply
  25. What i do not understood is in truth how you are not really a
    lot more neatly-favored than you might be right now. You are very intelligent.

    You know therefore considerably in relation to
    this subject, made me for my part consider it from numerous various
    angles. Its like women and men are not fascinated except
    it is something to accomplish with Woman gaga! Your individual stuffs
    great. All the time take care of it up!

    Reply
  26. My partner and I stumbled over here from a different page and thought I might check things
    out. I like what I see so now i’m following you. Look forward to finding out about your
    web page repeatedly.

    Reply
  27. Hmm it looks like your blog ate my first comment (it was super long) so I guess I’ll
    just sum it up what I submitted and say, I’m thoroughly enjoying your blog.
    I as well am an aspiring blog blogger but I’m still new
    to the whole thing. Do you have any tips for beginner blog writers?

    I’d really appreciate it.

    Reply
  28. Hi! Someone in my Facebook group shared this site with us so I came
    to check it out. I’m definitely loving the information. I’m bookmarking and
    will be tweeting this to my followers! Exceptional blog and fantastic design and style.

    Reply
  29. Nice post. I learn something totally new and challenging
    on websites I stumbleupon every day. It’s always helpful to read through articles from other writers and use something from their sites.

    Reply
  30. I think this is among the most vital info for me.
    And i’m glad reading your article. But wanna remark on some general things, The site style is perfect, the
    articles is really excellent : D. Good job, cheers

    Reply
  31. Magnificent beat ! I wish to apprentice even as you amend your website,
    how could i subscribe for a weblog site? The account aided me a applicable deal.
    I have been tiny bit acquainted of this your broadcast provided shiny transparent concept

    Reply
  32. Aw, this was a really nice post. Taking the time and actual effort
    to generate a top notch article… but what can I say… I hesitate
    a lot and never seem to get anything done.

    Reply
  33. It’s truly very difficult in this active life to listen news on Television, so I just use world wide web
    for that reason, and obtain the most recent news.

    Reply
  34. Excellent beat ! I wish to apprentice while you amend your
    website, how can i subscribe for a blog web site? The account helped
    me a acceptable deal. I had been a little bit acquainted of this your broadcast offered bright clear concept

    Reply
  35. Nice post. I learn something new and challenging on blogs I
    stumbleupon everyday. It will always be helpful to read through content from other authors and use something from their sites.

    Reply
  36. Magnificent items from you, man. I’ve bear in mind your stuff previous to and
    you are simply extremely wonderful. I actually like what you have
    bought here, really like what you are stating and the best
    way during which you say it. You are making it entertaining and you
    continue to care for to keep it sensible. I can not wait to learn far more from you.
    That is really a wonderful web site.

    Reply
  37. Do you mind if I quote a few of your posts as long as I provide
    credit and sources back to your weblog? My website is in the very same
    area of interest as yours and my users would genuinely benefit from a lot of the information you provide here.
    Please let me know if this okay with you. Appreciate
    it!

    Reply
  38. Hello there, I think your website could be having internet browser compatibility
    issues. Whenever I take a look at your site in Safari, it looks fine but
    when opening in Internet Explorer, it has some overlapping issues.
    I simply wanted to provide you with a quick heads
    up! Aside from that, great website!

    Reply
  39. I’m very happy to discover this page. I need to to thank you for your time for this particularly fantastic read!!
    I definitely enjoyed every part of it and i
    also have you saved as a favorite to look at new stuff on your web site.

    Reply
  40. You could definitely see your expertise within the
    article you write. The world hopes for even more passionate writers such as
    you who aren’t afraid to mention how they believe.
    At all times go after your heart.

    Reply
  41. It’s awesome to pay a quick visit this website and reading the views of
    all mates about this article, while I am also keen of getting know-how.

    Reply
  42. Outstanding post however I was wondering if you could write
    a litte more on this topic? I’d be very thankful
    if you could elaborate a little bit more. Many thanks!

    Reply
  43. I was recommended this web site by my cousin. I’m not sure whether
    this post is written by him as no one else know such detailed about my trouble.

    You are amazing! Thanks!

    Reply
  44. You’ve made some good points there. I looked on the web for additional
    information about the issue and found most individuals will go along with your views on this
    website.

    Reply
  45. Hi there! This is my 1st comment here so I just wanted to give
    a quick shout out and say I genuinely enjoy reading through your articles.
    Can you recommend any other blogs/websites/forums that cover the same subjects?
    Appreciate it!

    Reply
  46. My brother recommended I might like this blog.
    He was totally right. This post actually made my day.
    You can not imagine just how much time I had spent for this info!
    Thanks!

    Reply
  47. I’m not certain the place you are getting your info,
    however great topic. I needs to spend a while finding out more or understanding more.
    Thanks for wonderful info I used to be in search of this info for my mission.

    Reply
  48. It’s appropriate time to make some plans for the future and it’s
    time to be happy. I’ve learn this post and if I may just I wish to
    counsel you some attention-grabbing things or advice. Perhaps you can write next articles referring
    to this article. I wish to read more things approximately it!

    Reply
  49. When I initially commented I clicked the “Notify me when new comments are added” checkbox
    and now each time a comment is added I get four emails with the same comment.
    Is there any way you can remove people from that service?
    Thanks a lot!

    Reply
  50. Have you ever thought about publishing an e-book or guest authoring on other
    websites? I have a blog centered on the same ideas you discuss and would love to have you share some stories/information. I know my
    viewers would value your work. If you are even remotely interested, feel free
    to shoot me an e mail.

    Reply
  51. Before placing a bet it is crucial to do your research thoroughly
    and analyse the market. This will allow you to understand the
    players, teams, and their overall form. It
    is also important to research soccer betting strategies to get an idea of the way
    markets function. It is important to know the teams that
    you are betting on. This includes their shape strength, weaknesses, and form.
    Knowing these will allow you make better decisions when placing
    bets. The odds represent the probability of an event happening.

    Reply

Leave a Comment