Check your console.log()

1. open your console.

2. click on first button.

3. click on button inside the iframe.

function myFunction() is set here and show window.a = 'a' in this window

Then we export it with frames[0].myFunction = myFunction

Inside the iframe, var a = 'iframe'.

IFRAME: