let imageElement = document.getElementById('ImgCorrectConditon2'); //imageElement is null
if (imageElement === null) {
console.log('Exiting current line as control is null');
return;
}
imageElement.style.visibility = 'hidden';
If it's null, an exception/error will occur and the next lines of code will not execute. How can we prevent execution if the control is null?