roberto-butti / some-drops-of-javascript

This book collects some useful, unknown, underrated JavaScript functions discovered and learned while using JavaScript daily.
https://drops-of-javascript.hi-folks.dev/
Other
151 stars 46 forks source link

Add array groupby documentation #79

Closed shahzdvp closed 1 month ago

shahzdvp commented 1 month ago

Add documentation and example for array.groupBy() method

Description

This pull request adds comprehensive documentation and a practical example for the array.groupBy() method in JavaScript. This contribution aims to help developers understand and effectively use this method for grouping array elements.

Changes Made

  1. Documentation:

    • Created a new file src/content/docs/02-array/24_array-groupby.md
    • Provided detailed explanation of the array.groupBy() method
    • Included syntax, parameters, return value, and usage examples
    • Added notes on browser compatibility and alternatives
  2. Example:

    • Created a new file examples/02-24_array-groupby.mjs
    • Implemented a practical example using a sample inventory dataset
    • Demonstrated grouping of inventory items by their type
    • Added comments explaining each step of the process

Documentation Overview

The documentation covers:

Example Overview

The example demonstrates:

Testing and Formatting

Additional Notes

Checklist

I'm open to any feedback or suggestions for improvement on both the documentation and the example. Thank you for reviewing this contribution!

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
some-drops-of-javascript ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 1:35am
shahzdvp commented 1 month ago

here's the updated example, I got a bit confused while committing because I'm still learning Git

shahzdvp commented 1 month ago

is my pr is ok or do i want to make any changes

roberto-butti commented 1 month ago

ehi @shahzdvp your PR is great, i was thinking to move it , from array to object directory, because in the end the groupBy is a method for object. if you feel confident you can do it, otherwise i can merge it and then i can move it

shahzdvp commented 1 month ago

i think there is no object directory ,so i need to create one right..?

roberto-butti commented 1 month ago

i think there is no object directory ,so i need to create one right..?

@shahzdvp i mean this one: https://github.com/roberto-butti/some-drops-of-javascript/tree/main/src/content/docs/03-var