zoukankan      html  css  js  c++  java
  • Javascript全局对象

    The Global Object

      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 undefined, Infinity, and NaN
    • global functions like isNaN(), parseInt() (§3.8.2), and eval() (§4.12).
    • constructor functions like Date(), RegExp(), String(), Object(), and Array()
    (§3.8.2)
    • global objects like Math and JSON (§6.9) 

      In top-level code—JavaScript code that is not part of a function—you can use the JavaScript keyword this to refer to the global object: var global = this; // Define a global variable to refer to the global object In client-side JavaScript, the Window object serves as the global object for all JavaScript code contained in the browser window it represents. This global Window object has a self-referential window property that can be used instead of this to refer to the global object. The Window object defines the core global properties, but it also defines quite a few other globals that are specific to web browsers and client-side JavaScript.

  • 相关阅读:
    CentOS 6.5下Git服务器搭建
    汉化Eclipse+配色方法(官方语言包)
    Cocos2d-x内存管理研究<二>
    PHP模板解析类实例
    smarty的ASSIGN()函数
    详解 $_SERVER 函数中QUERY_STRING和REQUEST_URI区别
    phpstorm 格式化代码方法
    php get_magic_quotes_gpc()函数用法介绍
    php示例代码
    MySQL数据类型:SQL_MODE设置不容忽视
  • 原文地址:https://www.cnblogs.com/tekkaman/p/2865238.html
Copyright © 2011-2022 走看看