I have to decompose words into collections of letters in Javascript. Then I need to be able to i) check whether a letter belongs to the collection and ii) to remove letters for this collection progressively.
For example, the word 'cool' would be decomposed into 'c', 'o', 'o', 'l'. If I remove 'o', 'a' and 'l', I should be left with 'c', 'o' only.
What is the proper data structure to achieve this in Javascript?
Object(which a bit like a dictionary) andArray, from both of which you can build on more complicated collections.