Find the frequency of elements in array using the reduce method in JS

Published --