How to Use the New JS Object GroupBy Method

  Рет қаралды 4,023

Steve Griffith - Prof3ssorSt3v3

Steve Griffith - Prof3ssorSt3v3

Күн бұрын

Пікірлер: 26
@barungh
@barungh 7 ай бұрын
Congratulations on 100K subscribers, and thanks a lot for sharing your knowledge and expertise
@Mark-ms8gk
@Mark-ms8gk 7 ай бұрын
100k! It was a long journey but very well deserved. Congratulations!
@thejarxtv
@thejarxtv 7 ай бұрын
I always enjoy your videos, cheers on those 100K!
@cristian702
@cristian702 7 ай бұрын
Welcome back! Just noticed your new videos. Yes!
@codetechpro
@codetechpro 7 ай бұрын
I always enjoy your videos, something new I learned today, thanks Steve
@muhammadhossam8557
@muhammadhossam8557 7 ай бұрын
very helpful details thanks for your great videos
@LucianoClassicalGuitar
@LucianoClassicalGuitar 7 ай бұрын
Finally Steve is back!
@shahinza
@shahinza 7 ай бұрын
Thank you professor for the great video
@zbjz
@zbjz 6 ай бұрын
GroupBy Method starts at 5:50
@user_8911
@user_8911 7 ай бұрын
It would be nice to add performance comparison section to the video.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 7 ай бұрын
In terms of real world usage, unless you have multiple thousands of objects in your array it is not going to matter which approach you use. This method is for developer convenience.
@deepakvishwakarma2043
@deepakvishwakarma2043 7 ай бұрын
great ! can we also sort this based on no. of items in series instead of random order (length of keys : []) ?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 7 ай бұрын
You can group by length of keys yes. There is no sorting in an object. The order in an object is based on the order that the keys were added.
@sachin.tandon
@sachin.tandon 7 ай бұрын
Is there a way of using this function to do a 2-level nested grouped Map/Object, if one were to provide a pair of keys, e.g. { key, sub-key }
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 7 ай бұрын
It really depends on what you are trying to do. You might want to use reduce or flatMap
@SureddiBhargav
@SureddiBhargav 7 ай бұрын
Hello Sir, can you please make videos on node js background processes, how the cores come into play?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 7 ай бұрын
You can post tutorial requests here - kzbin.info/www/bejne/gnTIq5SuZ9qBacU
@binodsharma112
@binodsharma112 7 ай бұрын
Great video, Thank you
@xxapoloxx
@xxapoloxx 7 ай бұрын
why is this in object and not in array?.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 7 ай бұрын
It returns an Object not an array. The Map object also has a groupBy method if the keys are not strings or symbols.
@xxapoloxx
@xxapoloxx 7 ай бұрын
@@SteveGriffith-Prof3ssorSt3v3 so does reduce, this clearly a collection processing functionality, this belongs in array, this bad design.
@fellastout
@fellastout 7 ай бұрын
Lipstick on a pig (map method)? But it looks useful, thanks Steve.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 7 ай бұрын
It doesn't return an array, so closer to the reduce method
@aleksandarpopovic3615
@aleksandarpopovic3615 7 ай бұрын
behind the scene movies.reduce((groupBY, item) => { if(!groupBY[item.series]) groupBY[item.series] = []; groupBY[item.series].push(item) return groupBY }, {}) I don't understand the purpose of adding things without some benefit... nothing less code is written... who does not understand reduce, will not understand this either
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 7 ай бұрын
If all you are doing is what you did in that reduce statement, then with the new groupBy you could reduce all the code into this one line: Object.groupBy(movies, ({series})=>series); which I would argue is much easier to read and understand than the reduce method. I've been teaching Array.reduce to students for years and they frequently struggle with the syntax. The more complex the situation, the more options that you are adding, the longer the code becomes, regardless of which option you pick.
@lllllllllIIIIIIIIIIl
@lllllllllIIIIIIIIIIl 7 ай бұрын
You don't see the benefit of writing less code vs. more code? Wow. Where do you work, so we can all know not to apply?
Enhanced UI control and Responsible Accessibility with the HTML INERT Property
12:02
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 1,9 М.
All The JavaScript You Need To Know For React
28:00
PedroTech
Рет қаралды 672 М.
«Жат бауыр» телехикаясы І 26-бөлім
52:18
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 434 М.
КОНЦЕРТЫ:  2 сезон | 1 выпуск | Камызяки
46:36
ТНТ Смотри еще!
Рет қаралды 3,7 МЛН
Почему Катар богатый? #shorts
0:45
Послезавтра
Рет қаралды 2 МЛН
Iterable vs Enumerable in JavaScript
9:15
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 21 М.
Learn Why JavaScript Frameworks Love Signals By Implementing Them
20:15
Custom Events Dispatched from Web Components
20:32
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 2,6 М.
Chrome Dev Tools Source Panel and Breakpoints
18:21
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 7 М.
Google Cloud Platform:  PubSub Data using Cloud Functions Node js
11:04
Revealing the Differences between HTML Dialogs and the Popover API
24:14
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 9 М.
Why Is Array/Object Destructuring So Useful And How To Use It
13:24
Web Dev Simplified
Рет қаралды 431 М.
9 JavaScript Features You’ve Never Used
19:36
Conner Ardman
Рет қаралды 30 М.
Chrome Dev Tools Console Super Powers
16:44
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 9 М.
JavaScript Object Property Descriptors
13:21
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 15 М.
«Жат бауыр» телехикаясы І 26-бөлім
52:18
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 434 М.