JSFiddle - React, Tailwind, and code Playground

HTML

<input type="checkbox" id="cb0" />
<input type="checkbox" id="cb1" />
<input type="checkbox" id="cb2" />
<input type="checkbox" id="cb3" />
<button>Click</button>

JavaScript

function preCheck(boolArray){
 $("#cb0").prop("checked", boolArray[0]);
 $("#cb1").prop("checked", boolArray[1]);
 $("#cb2").prop("checked", boolArray[2]);
 $("#cb3").prop("checked", boolArray[3]);
}

var checks = [true, false, true, true, false];
$('button').click(function(){
    preCheck(checks);
});