# Introduction In this lab, we will learn about the `countBy` function, which is used to group the elements of an array based on the given function and returns the count of elements in each group. We will explore how this function can be used to map values of an array to a function or property name and how to create an object to count the elements in each group using `Array.prototype.reduce()`. We will also look at several examples to understand how to use this function in real-world scenarios.
Click the virtual machine below to start practicing