JSFiddle - React, Tailwind, and code Playground
HTML
<form id="formulario">
<input type="checkbox" name="checkbox" value="a1"/>
<input type="checkbox" name="checkbox" value="a2"/>
<input type="checkbox" name="checkbox" value="a3"/>
<input type="checkbox" name="checkbox" value="a4"/>
</form>
<a href="javascript:recuperarCheckbox()">mostrar</a>
JavaScript
function recuperarCheckbox(){
valores=new Array();
var checkboxes = document.getElementById("formulario").checkbox;
for (var i=0; i < checkboxes.length; i++){
if (checkboxes[i].checked){
valores.push(checkboxes[i].value);
}
}
for(var i=0; i<valores.length;i++){
alert(valores[i]);
}
}