document.getelementById('div'+i).style.display = "flex"; code example
Example: javascript display block
document.getElementById("someElementId").style.display = "block";
document.getElementById("someElementId").style.display = "block";