Skip to content

Instantly share code, notes, and snippets.

@wmantly
Created June 25, 2015 21:20
Show Gist options
  • Select an option

  • Save wmantly/f2c5b0c3523766ccca17 to your computer and use it in GitHub Desktop.

Select an option

Save wmantly/f2c5b0c3523766ccca17 to your computer and use it in GitHub Desktop.
1. Pure Javascript
Create a StringParser class that takes a string as constructor argument.
A StringParser instance must provide the following :
● Get the number of occurrences of a given character
● Get the characters with the most/least occurrences
● Be able to work in case insensitive mode (if needed).
Bonus points if:
● The methods can also be called directly without building a StringParser object (eg by
calling StringParser.prototype.xxx...)
● The methods can somehow also work on other array­like objects (eg arrays,
arguments object, DOM collections, etc)
● A StringParser instance can be constructed using a promise (that will eventually be
resolved to a string), feel free to adapt the interface for other methods (arguments, return values, callbacks...) for this case
You should also provide documentation for your class (any format ­ doesn't matter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment