Question: I have an iframe `ifr` and a document `doc`. I want to set the iframe's content/document using a loaded document.

What I have now is:

```
ifr.contentDocument.open();
ifr.contentDocument.write(doc.documentElement.innerHTML);
ifr.contentDocument.close();

```

What this does is that it **copies** the content of the document in HTML into the iframe's document.

What I want is to make the iframe display the loaded document without copying it. In that case another iframe can display the same document instance and any modifications will be done in both iframes.

Is this possible in any way in JavaScript?

Answer: 
Assigning a new object to the local variable doesn't help you here. But as dictionaries are mutable, you can clear and update the original dictionary given the new data:

```
def modify(a_dict):
    alt_dict = a_dict.copy()
    alt_dict['s'] = 2
    a_dict.clear()
    a_dict.update(alt_dict)

```
How about returning the modified copy?

```
def modify(a_dict):
    alt_dict = a_dict.copy()
    alt_dict['s'] = 2
    return alt_dict

a_dictionary = {}
a_dictionary['f'] = 5

a_dictionary = modify(a_dictionary)
print(a_dictionary)

```