It is also the "global" object in JavaScript. As such, any global variable that you define is accessible as a property of the window object. This can avoid unnecessary use of eval()
to retrieve a global object/function for which the name is only available in the form a string.
E.g. ```
var myVariable = 23; function aFunction(paramA) { alert(myVariable); // 23 alert(window.myVariable); // 23 alert(window['myVariable']; // 23 if (typeof paramA === 'string') { alert(window[paramA]); // 23 if paramA is 'myVariable' } alert(eval('myVariable')); // 23, but much slower because the compiler has to kick in. if (typeof paramA === 'string') { alert(eval(paramA)); // 23 if paramA is 'myVariable' but again slower, and poses security risk. } }```
EspaƱol
Properties
- clientInformation
- clipboardData
- closed
- content
- controllers
- crypto
- defaultStatus
- dialogArguments
- dialogHeight
- dialogLeft
- dialogTop
- dialogWidth
- directories
- event
- frameElement
- frames
- fullScreen
- globalStorage
- history
- innerHeight
- innerWidth
- length
- location
- locationbar
- menubar
- name
- navigator
- offscreenBuffering
- opener
- outerHeight
- outerWidth
- pageXOffset
- pageYOffset
- parent
- personalbar
- pkcs11
- returnValue
- screen
- screenLeft
- screenTop
- screenX
- screenY
- scrollbars
- scrollMaxX
- scrollMaxY
- scrollX
- scrollY
- self
- sessionStorage
- sidebar
- status
- statusbar
- toolbar
- top
- XMLHttpRequest
- window
Methods
- alert()
- atob()
- attachEvent()
- back()
- blur()
- btoa()
- captureEvents()
- clearInterval()
- clearTimeout()
- close()
- confirm()
- createPopup()
- disableExternalCapture()
- detachEvent()
- dispatchEvent()
- dump()
- enableExternalCapture()
- escape()
- execScript()
- find()
- focus()
- forward()
- getComputedStyle()
- getSelection()
- home()
- moveBy()
- moveTo()
- navigate()
- open()
- openDatabase()
- openDialog()
- print()
- prompt()
- releaseEvents()
- removeEventListener()
- resizeBy()
- resizeTo()
- routeEvent()
- scroll()
- scrollBy()
- scrollByLines()
- scrollByPages()
- scrollTo()
- setActive()
- setInterval()
- setResizable()
- setTimeout()
- showHelp()
- showModalDialog()
- showModelessDialog()
- sizeToContent()
- stop()
- unescape()
- updateCommands()