Posts List

JavaScript Algorithms Part 4. MAXIMUM CHARACTER

Image credits: Pixelstalks Question Write a function to return the maximum occurring character in the input string e.g., if input string is “Test” then function should return ‘t’. Note: capital letter ‘T’ and small letter ‘t’ should count as the same. In writing a function to satisfy the above question, the first thing to do is to change every input entered by the user to lower case. Let us consider the string ‘Test’, our expected result is that the letter ‘t’ should return 2, the letter ‘e’ and ‘s’ should return 1.