JSFiddle - React, Tailwind, and code Playground
by riateche
HTML
<input id="i1">
JavaScript
var a = [];
$("#i1").keydown(function(e) {
var letter = String.fromCharCode(e.keyCode);
if (a.indexOf(letter) < 0) {
a.push(letter);
console.log(a);
}
}).keyup(function(e) {
var letter = String.fromCharCode(e.keyCode);
if ( (n = a.indexOf(letter)) >= 0) {
a.splice(n);
}
console.log(a);
})