1. function eventHandler(e) {
    2. if (!e) e = window.event;
    3. }
    4. //可以替换为:
    5. function eventHandler(e) {
    6. e = e || window.event;
    7. }
    1. if (myobj) {
    2. doSomething(myobj);
    3. }
    4. //可以替换为:
    5. myobj && doSomething(myobj);