You have to be quite clear about the difference between a name and a reference to an object.
When you type:
that returns a Window object which is referenced by the variable myWindow. That object contains all the properties and methods you need to manipulate that window. For example:
One of the many properties available in the Window object referenced by the variable myWindow is myWindow.name.
This is a String, not a Window. So you can use String methods and access String properties, but you can't use Window methods or properties on it. This is OK:
This is not:
If you try this:
popup will not have been initialized as a variable; if you try
you will get an error message to the effect that "popup.document has no properties". What this means is that the top-level variable popup does not contain an object called document -- not surprising, because it has only just been initialized and nothing has been assigned to it.