我想调用函数_.lpad('1', 2, '0')
,但chrome显示我Uncaught TypeError: _.lpad is not a function
。我已经在HTML文件中包含了脚本标签,如下所示。
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.string/3.3.4/underscore.string.min.js"></script>
如果我调用console.log(_)
,它显示我:
>console.log(_)
function (n){return n instanceof m?n:this instanceof m?void(this._wrapped=n):new m(n)}
你能告诉我为什么和如何解决它吗?
s.lpad('1', 2, '0')
下划线。字符串导出为窗口。