<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>constructorfunctionInherit</title>    <script type="text/javascript">    //声明父类    function superClass(id){  …
<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>prototypeInherit</title>    <script type="text/javascript">    //原型式继承:实质上就是类式继承的函数封装(但有缺陷)    function inher…
1.单对象克隆 <!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>singleClone</title>    <script type="text/javascript">    var clone = function(target,obj){        fo…
<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>groupInherit</title>    <script type="text/javascript">    //声明父类    function superClass(name){        this.n…
<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>classInherit</title>    <script type="text/javascript">    //声明父类    function superClass(){        this.name…
技巧点:对象方法中返回当前对象就可以链式调用了,即方法中写return this; <!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>returnObject</title>    <script type="text/javascript">    var chec…
<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>closure的自调用函数式写法</title>    <script type="text/javascript">    var a = (function(name){        var n = name; …
<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>closure</title>    <script type="text/javascript">    function fn(){        var n = '123';        return func…
<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>constructorfunctionInherit</title>    <script type="text/javascript">    //声明父类    function superClass(id){  …
1.面向对象模式装饰者 <!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>面向对象—Decorator装饰者模式</title>    <script type="text/javascript">    //给实例对象(注:不影响类)动态添加职责的方式叫做Decor…