Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
JavaScript groupBy is not a functio

i want to group my Data with the Name of type

const inventory = [
         { name: 'asparagus', type: 'vegetables', quantity: 5 },
         { name: 'bananas',  type: 'fruit', quantity: 0 },
         { name: 'goat', type: 'meat', quantity: 23 },
         { name: 'cherries', type: 'fruit', quantity: 5 },
         { name: 'fish', type: 'meat', quantity: 22 }          
       let result = inventory.groupBy( ({ type }) => type );

on above getting error as groupBy is not a functio

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

JavaScript arrays don't have a groupBy method yet. See MDN's documentation. It's in nightly Firefox builds at the moment and that's all. The proposal is Stage 3 so it'll be landing in JavaScript engines before too long, but in the meantime you have to polyfill it. There are various ways to polyfill it, for instance via core-js. (Babel used to do polyfilling, but now recommends using core-js directly.)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!