zoukankan      html  css  js  c++  java
  • underscore.js 分析 第三天

      // Create a safe reference to the Underscore object for use below.
      // 为Underscore对象创建一个安全的引用
      // _为一个函数对象,它的实例服从单例模式。
      var _ = function(obj) {
        if (obj instanceof _) return obj;
        if (!(this instanceof _)) return new _(obj);
        this._wrapped = obj;
      };

    来一个最简单的例子

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title>Underscore</title>
        <script src="underscore.js"></script>
    </head>
    <body>
    </body>
    </html>
    
    
    <script type="text/javascript">
    // 在浏览器中 _ 是全局对象
    // 查看Underscore的当前版本
    alert(_.VERSION);
    </script>
  • 相关阅读:
    2015多校.Zero Escape (dp减枝 && 滚动数组)
    UVa-11809
    UVa-1588 Kickdown
    UVa-1587
    UVa-10340
    UVa-202
    UVa-1368
    UVa-232 Crossword Answers
    UVa-227
    UVa-455 Periodic Strings
  • 原文地址:https://www.cnblogs.com/mafeifan/p/3972884.html
Copyright © 2011-2022 走看看