let btn = document.getElementById('btn');
let hello = document.getElementById('hello');
function test() {
if (hello.style.display !== 'none') {
hello.style.display = 'none';
} else {
hello.style.display = 'block';
}
}
btn.addEventListener('click', test)
<div id='hello'>
hello
</div>
<div id='btn'>
button
</div>