How to get id of previous element, before iframe?

This should be simple but it seems not to be. This is my HTML:

<div id="mask" class="hide">
 <div id="page" style="height: 90%; width: 475px;">
  <iframe id="modal" class="iframe" src="blank.php"></iframe> 
 </div>
</div>

This is my Javascript:

 let modal = document.getElementById("modal");
 console.log(modal.previousSibling.id); // show undefined
 console.log(modal.previousElementSibling.id); // throws JS error: null

So how do I get the id’s of the 2 previous divs, no jquery please? The iframe is not open at this time and I’m not inside the iframe when I run the JS. I have searched alot but found nothing that fits my needs.

Thank you for any and all help,
Charles