Why use an iFrame for HTML tests

Hi FCC maintainers,

Just wondering about the reason behind using an iframe to display output for lessons that involve the DOM

For example this question:

I’m working on a project that involves building our own practice question UI as well. Just wondering about the considerations made.

Thanks!