Ocultar o Mostrar Elementos html con js

//elemento html
<div id="myDIV"> </div>

//funcionn js
function myFunction() {
    var x = document.getElementById("myDIV");
    if (x.style.display === "none") {
        x.style.display = "block";
    } else {
        x.style.display = "none";
    }
}
Junior Cercado Vasquez