Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

var name and window.name

Tags:

javascript

If I define a JavaScript global variable called name, does that hide the window.name property?

I ask this in the context of the Facebook JavaScript authentication API, since I noticed that having a global of that name would break it, and also since I see that window.name is used in their code.

like image 709
Steve Teale Avatar asked Jun 16 '12 15:06

Steve Teale


1 Answers

If name is a global variable, then name and window.name are equivalent.

Global variables and functions are members of the global object. In browsers, the global object contains a window member whose value is the global object.

like image 73
Matt Coughlin Avatar answered Nov 09 '22 23:11

Matt Coughlin