Skip to content

Files

Latest commit

 

History

History

Day 34

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Write a program to find the most frequent item of an array

Instructions

  • Input : const arr = [3, 'a', 'a', 'a', 2, 3, 'a', 3, 'a', 2, 4, 9, 3];
  • Output : a 5

Challenges (0/2 done)

  • mostFreq([1, 2, 2, 4, 5, 6, 6]) returns 2 2
  • mostFreq([3, 'a', 'a', 'a', 2, 3, 'a', 3, 'a', 2, 4, 9, 3]) returns a 5
function mostFreq(arr) {
	// write your code here
	return
}

const arr = [1, 2, 2, 4, 5, 6, 6];

console.log(mostFreq(arr));