![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JS
文章平均质量分 77
崩了呀
一声梧叶一声秋,一点芭蕉一点愁,三更归梦三更后
展开
-
js的exports
//写法1exports.hello = function(){ console.log(‘world’);}//写法2var f = { hello : function(){ console.log(‘world’); }}module.exports = f;假设我们写的这个模块的文件名为hello.js,执行下面的代码var h = require(‘hel...原创 2018-03-31 11:54:16 · 14801 阅读 · 0 评论 -
JS使用模板快速填充HTML控件数据
function formatTemplate(dta, tmpl) { var format = { name: function(x) { return x ; } }; return tmpl.replace(/{(\w+)}/g, function(m1, m2) { ...转载 2018-04-12 18:07:07 · 1384 阅读 · 0 评论 -
JS中的类数组对象
在javascript中,对象与数组都是这门语言的原生规范中的基本数据类型,处于并列的位置。一般来说,如果我们有一个对象obj和一个数组a:obj["attr1"]; //取obj对象的attr1属性 a[1]; //取数组a中的第二个元素 但是,有些时候,也会将一个对象“伪装”成一个数组来用,我们把这种对象称为“类数组对象”,再此...转载 2018-11-07 13:57:11 · 1623 阅读 · 0 评论