EXERCISE · AlgoCasts

Max char

Given a string, return the character that is most commonly used in the string.

3 testsAlgoCastsGPL-3.0exercise 04 of 26

Directions

Directions

Given a string, return the character that is most commonly used in the string.

Examples#

JS
maxChar("abcccccccd") === "c"maxChar("apple 1231111") === "1"

Try it first#

Copy the stub, make the 3 tests pass on your machine, then open the solution. The reveal is remembered per page in this browser.

JSexercises/maxchar/index.js
function maxChar(str) {} module.exports = maxChar;

See also