Determine which range a character falls into
Those "parent groups" look a lot like regular expressions, specifically character sets.  You could perform regular expression matches for patterns like ^[A-F].



function parentGroup(char) {
    var groups = ['A-F', 'G-M', 'N-R', 'S-Z', '0-9'];
    for (var i = 0; i &lt; groups.length; i++) {
        if (char.match('^[' + groups[i] + ']')) {
            return groups[i];
        }
    }
}

document.getElementById('in').addEventListener('keyup', function(e) {
    document.getElementById('out').textContent = parentGroup(e.target.value);
});
&lt;div&gt;Enter text, starting with a digit or uppercase letter: &lt;input id="in" type="text" size="10"&gt;&lt;/div&gt;
&lt;div&gt;Parent group: &lt;span id="out"&gt;&lt;/span&gt;&lt;/div&gt;