Check if a div does NOT exist with javascript

var myElem = document.getElementById('myElementId');
if (myElem === null) alert('does not exist!');

if (!document.getElementById("given-id")) {
//It does not exist
}

The statement document.getElementById("given-id") returns null if an element with given-id doesn't exist, and null is falsy meaning that it translates to false when evaluated in an if-statement. (other falsy values)