Skip to content
Advertisement

Tag: namespaces

Benefit of using ‘window’ prefix in javascript

Are there any benefits to using the ‘window’ prefix when calling javascript variables or methods in the window object? For example, would calling ‘window.alert’ have an advantage over simply calling ‘alert’? I can imagine using the prefix could give a small performance boost when the call is made from inside some function/object, however I rarely see this in people’s code.

Advertisement