Hard
Finding the Most Frequent Element in JavaScript Array Using Reduce Method
You are tasked with finding the most common element in an array. Which of the following code snippets correctly accomplishes this?
1const items = ['apple', 'banana', 'apple', 'orange', 'banana', 'apple'];23// Your task: Write a function to determine the most frequent item in the array.