i have H1 in css whose color is orange but when i make a click event in JS having a if statement requiring the color of H1 to be orange to proceed but it doesnt.i have a div which is just a red square and i gave it a display of none. and also when i log it into the console it shows display'' even tho i gave it a display none.
this is the html:-
<body>
<h1>hello worrld</h1>
<p>this is a p tag</p>
<div></div>
<button> click me!</button>
<script src="app.js"></script>
</body>
this is the css:-
h1{
color: orange;
}
div{
height: 100px;
width: 100px;
background-color: red;
margin-bottom: 40px;
display: none;
}
this is the javascript:-
const h1 = document.querySelector('h1');
const div = document.querySelector('div');
const btn = document.querySelector('button');
btn.addEventListener('click', () => {
if( h1.style.color == 'orange'){
div.style.display = 'block';
};
console.log(div.style);
});