`

OO Javascript notes

阅读更多

1. a few concepts to remember

  • Expression: Something which evaluates to a value. Example: 1+2/x (to be executed, return a value).
  • Statement: A line of code which does something. Example: GOTO 100
  • Function delcaration : function Identifier ( FormalParameterList opt ){ FunctionBody }
  • Function expression : function Identifier opt ( FormalParameterList opt ){ FunctionBody }

try to understand their position and relationship in javascript is quite important.

 

Ref: http://stackoverflow.com/questions/19132/expression-versus-statement

Ref: http://yura.thinkweb2.com/named-function-expressions/

 

2. Object.constructor will return who object declaration. e.g. [].constructor = function Array(){}

 

3. object.constructor.name will display the name of the object.

e.g. [].constructor.name == Array

 

4. another good article:  http://jibbering.com/faq/faq_notes/closures.html

 

5. *Never no that until now* if you were to declare saying without the var keyword preceding it, it would automatically become a global variable

 ref: http://robertnyman.com/2008/10/09/explaining-javascript-scope-and-closures/

 

6. understand javascript closure , prototype property of an object is important to understand OO JS.

 

 

Here is a nice graphic for OO JS, I copied from another guy in Javaeye.

 


Refhttp://www.iteye.com/wiki/Object_Oriented_JavaScript/1317-javascript-object-oriented-technology-

6

 

 

 

 

  • 大小: 29.3 KB
分享到:
评论

相关推荐

    Transition to OO Programming Lecture Notes (Cornell CS1130)

    Transition to OO Programming Lecture Notes (Cornell CS1130)

    JavaScript_oo:javascript面向对象

    JavaScript-oo类类(Class)定义了一件事物的抽象特点。通常来说,类定义了事物的属性和它可以做到的(它的行为)。举例来说,“狗”这个类会包含狗的一切基础特征,即所有“狗”都共有的特征或行为,例如它的孕育、...

    oojs:面向对象 javascript 库的强大功能

    OOjs 是一个用于处理对象的 JavaScript 库。 主要功能包括继承、mixin 和用于处理对象的实用程序。 /* Example */ ( function ( oo ) { function Animal ( ) { } function Magic ( ) { } function Unicorn ( )...

    Professional JavaScript for Web Developers英文版

    This book is aimed at three groups of readers: Experienced object-oriented programming developers looking to learn JavaScript as it relates to traditional OO languages such as Java and C++; Web ...

    maelstrom:OO JavaScript GameEngine 和示例游戏

    基于示例游戏的简单 OO JavaScript Canvas 游戏引擎 这是一个演示:http: (方向键移动,空格键射击) 去做 在第一级负载上添加 invuln 从引擎中删除 .init,找出更好的方法来做到这一点,因为它很混乱 重构demo...

    JavaScript.Object.Programming.148421

    What are and how to use OO principles in JavaScript How to use Constructors with JavaScript and more Audience This book is for both intermediate and advanced JavaScript and Web development ...

    tictactoe-in-[removed]用 OO JavaScript 编写的井字游戏

    javascript 中的 tictactoe 一个用 OO JavaScript 编写的简单井字游戏

    OO in JavaScript

    这是一篇深入探讨JavaScript对象模型的文章。 JavaScript是基于原型的语言,她的弱类型成为她缺点的同时也使得她非常灵活。作者对JavaScript的原型的应用使读者对面向对象的机制有了新的认识。对于想深入了解...

    OO4O(Oracle Objects for OLE C++ Class Library)

    Visual C++, Visual Basic For Applications (VBA), and IIS Active Server Pages (VBScript and JavaScript). OO4O consists of an in-process COM Automation Server, the C++ class library, and the Oracle ...

    procedural-to-oo-javascript

    P6 JavaScript面向OO的重构程序 ##学习能力 在对象之间实现干净灵活的接口 分解各个方面的问题,包括(但不限于):关注点分离,德米特定律,使用频率,变化频率,封装,松散耦合和单一责任原则 编写OO JavaScript ...

    encapsulate:JavaScript OO系统

    JavaScript OO系统 内容 介绍 要求 用法 测验 介绍 Encapsulate是一个用于JavaScript的紧凑的OO系统,它允许您结合使用特征(对象或提供成员的函数)和其他实例化器(您可能将其称为继承)来轻松创建对象实例化器...

    JavaScript面向对象编程指南(第2版)

    , 本书全面地覆盖了JavaScript语言的OO特性,同时兼顾基础知识,对初学者来说,是难得的JavaScript佳作。读者不需要具备任何的JavaScript基础知识及项目经验,通过学习这本书,将会在面试有关JavaScript程序设计的...

    JavaScriptix - OO Javascript Repository-开源

    该项目将提供多个用 JavaScript 的 OO 语法编写并存储在 .js 文件中的类库。 其目的是模块化 JavaScript 代码并改进其文档。 该项目的另一个主要举措是创建可重复使用的 sc

    ABAP OOALV学习文档

    ABAP OOALV报表开发,定义变量,选择屏幕定义,创建类,调用函数,是学习OOALV很不错的学习资料

    javascript 封装技术

    全面介绍如何用OO方式封装Javascript,高手必看。

    javascript面向对象技术基础

    javascript面向对象技术基础

    实战OO 用例 建模

    实战OO_用例建模 实战OO_用例建模 实战OO_用例建模

    Professional JavaScript for Web Developers, 3rd Edition

    This book is aimed at three groups of readers: Experienced object-oriented programming developers looking to learn JavaScript as it relates to traditional OO languages such as Java and C++; Web ...

    Object.Oriented.JavaScript

    This book explores JavaScript for what it is: a highly expressive and lexible prototype-based object-oriented programming language. Once dismissed as a toy for designers to make things such as ...

    Javascript-OOJS:Javascript 中的面向对象编程

    Javascript 使用 Javascript 测试代码将添加面向对象的 Javascript

Global site tag (gtag.js) - Google Analytics