Xiang Wang @ 2018-08-14 09:15:38

Guide

  • [ ] Introduction

  • Working with objects 使用对象

    • object[obj] = value:

    the inner obj can be anything, but since the object only accept string as a key, it will call obj.toString() as the key

    for (var i in object) {console.log(object[i])}
    
    • Creating new objects

    # Using object initializers
    var obj = {property_1: value_1, ..}
    
    # Using a constructor function
    function Car(make, model, year) {
        this.make = make;
        this.model = model;
        this.year = year;
    }
    var mycar = new Car('Eagle', 'Talon TSi', 1993);
    
    • [ ] use Object.create()

    • [ ] Inheritance 继承

    • use jquery to extend a dict $.extend(obj1, obj2, ...)

  • [ ] Meta programming