function test(options){
            $.extend({ },this.Default,options);
    
            var v = this.Default || options;
            alert(v.name);//传入打印'嘻嘻嘻嘻',不传入打印'呵呵呵'
        }   
        test.prototype.Default = {
         name:'呵呵呵'
        };
        new test({name:'嘻嘻嘻嘻'});
     //js可传入对象,也可不传入,不传入时使用默认
 
 
function test1(options){
         var defaults = { name: "foo" };
            $.extend({ },defaults,options);
    
            var v = defaults || options;
            alert(v.name);//传入打印'嘻嘻嘻嘻',不传入打印'呵呵呵'
        }   
        new test1({name:'ssss'});

随机推荐

  1. 你不知道的JavaScript--Item34 大白话解说Promise

    去年6月份. ES2015正式公布(也就是ES6.ES6是它的乳名),当中Promise被列为正式规范.作为ES6中最重要的特性之中的一个,我们有必要掌握并理解透彻.本文将由浅到深,解说Promise ...

  2. chosen.jquery.js 使用笔记

    using chosen.jquery.js using chosen.jquery.css html: <label for="MeetingUsersList" clas ...

  3. zoj3605 Find the Marble --- 概率dp

    n个杯子.球最開始在s位置.有m次换球操作,看到了k次,看的人依据自己看到的k次猜球终于在哪个位置,输出可能性最大的位置. dp[m][k][s]表示前m次操作中看到了k次球终于在s的频率. #inc ...

  4. Combining an audio file with video file in python

    Combining an audio file with video file in python - Stack Overflow https://stackoverflow.com/questio ...

  5. java.io.IOException: The same input jar is specified twice

    简介: eclipse android proguard 打包时出现 java.io.IOException: The same input jar is specified twice 错误, 这里 ...

  6. bzoj1977 [BeiJing2010组队]次小生成树 Tree——严格次小生成树

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1977 因为严格,所以要记录到 LCA 的一个次小值: 很快写好,然后改掉一堆错误后终于过了样 ...

  7. ubuntu系统快捷键设置

    1.打开'系统设置' 2.点击键盘 3.选择快捷键,查看和修改对应的快捷键.

  8. Android 数据库

    官方文档:https://developer.android.com/training/basics/data-storage/databases.html#WriteDbRow 原帖:http:// ...

  9. $P2299 Mzc和体委的争夺战$

    \(problem\) #ifdef Dubug #endif #include <bits/stdc++.h> using namespace std; typedef long lon ...

  10. Mac上随时切换PYTHON版本

    在MAC上,默认安装了python2.*,自己又安装了python3.*:假如我们需要在终端上随时切换python控制台到需要的版本,可以采用下面的方法. 1.用命令   sudo vi ~/.bas ...