This questions has many solutions but this one is the most efficient as the time complexity is O(n)
On this page of the site you can watch the video online Counting array elements frequencies JavaScript with a duration of hours minute second in good quality, which was uploaded by the user Coding Optimized 29 September 2021, share the link with friends and acquaintances, this video has already been watched 983 times on youtube and it was liked by 16 viewers. Enjoy your viewing!