JavaScript ---- The Global Object

1. The global object is a regular JavaScript object that serves a very important purpose: the properties of this object are the globally defined symbols that are available to a JavaScript program.
When the JavaScript interpreter starts(or whenever a web browser loads a new page), it creates a new global object and gives it an initial set of properties that define:
global properties like [b]undefined[/b], [b]Infinity[/b], and [b]NaN[/b]
global functions like [b]isNaN()[/b], [b]parseInt()[/b] and [b]eval()[/b]
constructor functions like [b]Date()[/b], [b]RegExp()[/b], [b]String()[/b], [b]Object()[/b], and [b]Array()[/b]
global objects like [b]Math[/b] and [b]JSON[/b]


2. In top-level code----JavaScript code that is not part of a function----you can use the JavaScript keyword [b]this[/b] to refer to the global object:
var global = this;     // Define a global variable to refer to the global object


3. In client-side JavaScript, the Window object serves as the global object for all JavaScript code contained in the browser window in represents. This global Window object has a self-referential [b]window[/b] property that can be used instead of [b]this[/b] to refer to the global object.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值