In Java you could do something like:

Person adam = new Person();

In JavaScript you would do:

var adam = new Person();

JavaScript’s constructor invocation looks as if

Person were a class, but it’s important to keep in mind that Person is still just a function.

Principle

When it comes to adopting an inheritance pattern for your project, you have quite a few options. You should always strive for picking a modern pattern, unless the team is really uncomfortable if there are no classes involved.

References: 

JavaScript Patterns - by Stoyan Stefanov (O`Reilly)

JavaScript Patterns 6.1 Classical Versus Modern Inheritance Patterns的更多相关文章

  1. django.core.exceptions.ImproperlyConfigured: The included URLconf 's9luffycity.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused

    出现问题: $ python manage.py runserver 启动项目报错时候 raise ImproperlyConfigured(msg.format(name=self.urlconf_ ...

  2. JSONPath中的表达式

    在JsonPath中使用表达式是一个非常好的功能,可以使用简洁和复杂的JsonPath.JsonPath中的表达式基本上是评估为布尔值的代码片段.基于结果,仅选择满足标准的节点.让我们看一下它的更多内 ...

  3. JavaScript Patterns 1 Introduction

    1.1 Pattern "theme of recurring events or objects… it can be a template or model which can be u ...

  4. Memory leak patterns in JavaScript

    Handling circular references in JavaScript applications Plugging memory leaks in JavaScript is easy ...

  5. JavaScript资源大全中文版(Awesome最新版)

    Awesome系列的JavaScript资源整理.awesome-javascript是sorrycc发起维护的 JS 资源列表,内容包括:包管理器.加载器.测试框架.运行器.QA.MVC框架和库.模 ...

  6. 每个JavaScript开发人员应该知道的33个概念

    每个JavaScript开发人员应该知道的33个概念 介绍 创建此存储库的目的是帮助开发人员在JavaScript中掌握他们的概念.这不是一项要求,而是未来研究的指南.它基于Stephen Curti ...

  7. 大型 JavaScript 应用架构中的模式

    原文:Patterns For Large-Scale JavaScript Application Architecture by @Addy Osmani 今天我们要讨论大型 JavaScript ...

  8. [转]大型 JavaScript 应用架构中的模式

    目录 1.我是谁,以及我为什么写这个主题 2.可以用140个字概述这篇文章吗? 3.究竟什么是“大型”JavaScript应用程序? 4.让我们回顾一下当前的架构 5.想得长远一些 6.头脑风暴 7. ...

  9. JavaScript- The Good Parts Chapter 5 Inheritance

    Divides one thing entire to many objects;Like perspectives, which rightly gazed uponShow nothing but ...

随机推荐

  1. TFS签入签出规范

    TFS签入签出规范1)开发平台的约定a)开发操作系统环境和最终用户使用环境 包含Service Pack版本号开发环境 Windows2008SP1 Windows7用户环境 Windows2008S ...

  2. Delphi iOS 开启文件共享 UIFileSharingEnabled

    Apple 在 iOS 提供了文件共享(FileSharing)功能,让 App 有一个对外窗口的目录,透过 iTunes 可以任意管理这个目录的文档内容(可拖入文档,也能将文档拖出备份). 如果 A ...

  3. hdu-1856-More is better

    More is better Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 327680/102400 K (Java/Others) ...

  4. 通过angularJS官方案例快速入门

    官方案例-angular-phonecat angularJS官方提供了一个官方案例给大家进行循序渐进的学习,但是如果之前没有接触过node.js以及git的同学这个案例拿着也无从下手-这里就介绍一下 ...

  5. selenium启动firefox时加载扩展

    有些时候,我们测试需要用到插件或者已经导入的证书(比如金融和安全加密行业),而selenium启动firefox时会打开一个新的,不含有任何插件和个人证书的firefox(等同于全新安装后第一次打开的 ...

  6. Webform(邮箱模式)

    <asp:Repeater ID="Repeater1" runat="server"> <HeaderTemplate> <ta ...

  7. 使用Sublime Text作为Markdown编辑器

    Sublime Text 3作为一个优秀的文本编辑器,拥有很多的扩展插件.我们可以利用这些插件为Sublime Text 增加扩展的功能,在这里我们借助两个插件来将Sublime Text 3变成一个 ...

  8. HTML5锚点请用id代替name

    HTML5已经去掉name属性,实现锚点时请使用id,实例效果:http://keleyi.com/keleyi/phtml/html5/9.htm 支持Chrome,火狐,IE8以上等浏览器. 以下 ...

  9. [deviceone开发]-课程表的例子

    一.简介 这个例子是根据一个真实app的一个页面的需求来实现的demo,通过动态add ui的方式,动态bind数据构建一个完整的课程表示例.示例并不完善,但是可以给大家一个启发. 二.效果图 三.相 ...

  10. Swift安装

    Server1 .Update sudo apt-get update sudo apt-get upgrade . sudo apt-get install bridge-utils .IP 3.1 ...