JSFiddle - React, Tailwind, and code Playground
HTML
<input type="button" value="Generar" />
<span id="Clave"></span>
JavaScript
var numeros = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
$(':button').click(function(){
var alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
var alphaIndex, numIndex, spn = '';
for (var i = 0; i < 4; i++) {
alphaIndex = Math.floor((Math.random() * alpha.length));
spn = spn + ((i === 0) ? alpha[alphaIndex].toString().toUpperCase() : alpha[alphaIndex]);
alpha.splice(alphaIndex, 1);
}
for (var j = 0; j < 2; j++) {
numIndex = Math.floor((Math.random() * numeros.length));
spn = spn + numeros[numIndex];
}
document.getElementById('Clave').innerHTML = spn + spn.substring(spn.length-2);
});