上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 31 下一页
摘要: // EcmaScript 6 对数组新增了很多方法 // find // findIndex // find 接收一个方法作为参数,方法内部返回一个条件 // find 会遍历所有的元素,执行你给定的带有条件返回值的函数 // 符合该条件的元素会作为 find 方法的返回值 // 如果遍历结束还没 阅读全文
posted @ 2019-02-25 23:40 lujieting0 阅读(207) 评论(0) 推荐(0) 编辑
摘要: <!-- 异步函数 setTimeout readFile writeFile readdir ajax --> <script> function get(url,callback) { var oReq = new XMLHttpRequest() //当请求加载成功之后要调用指定的函数 oRe 阅读全文
posted @ 2019-02-25 23:39 lujieting0 阅读(154) 评论(0) 推荐(0) 编辑
摘要: <script> function add(x,y,callback) { // callback 就是回调函数 // var x = 10 // var y = 20 // var callback = function(a){ } console.log(1) setTimeout(functi 阅读全文
posted @ 2019-02-25 23:38 lujieting0 阅读(84) 评论(0) 推荐(0) 编辑
摘要: <!--文件操作路径--> <!-- 在文件操作路径的相对路径中 ./data/a.txt 相对于当前目录 data/a.txt 相对于当前目录 /data/a.txt 绝对路径,当前文件模块所处磁盘根目录 c:/xx/xxx... 绝对路径 fs.readFile(`./data/a.txt`,f 阅读全文
posted @ 2019-02-25 23:37 lujieting0 阅读(322) 评论(0) 推荐(0) 编辑
摘要: require('./a') // 优先从缓存加载 // 由于 在 a 中已经加载过 b 了 // 所以这里不会重复加载 // 可以拿到其中的接口对象,但是不会重复执行里面的代码 // 这样做的目的是为了避免重复加载,提高模块加载效率 var fn = require('./b') console. 阅读全文
posted @ 2019-02-25 23:36 lujieting0 阅读(192) 评论(0) 推荐(0) 编辑
摘要: <script> // IE 8 不支持 ;['abc', 'd', 'efg'].forEach(function (item, index) { console.log(item) }) // 遍历 jQuery 元素 $.each(['abc', 'd', 'efg'], function ( 阅读全文
posted @ 2019-02-25 23:33 lujieting0 阅读(172) 评论(0) 推荐(0) 编辑
摘要: var http = require('http') var fs = require('fs') var template = require('art-template') var path = require('path') var server = http.createServer() v 阅读全文
posted @ 2019-01-20 21:51 lujieting0 阅读(417) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>06-在浏览器中使用art-template</title> </head> <body> <!-- 注意:在浏览器中需要引用 lib/template-web 阅读全文
posted @ 2019-01-20 21:50 lujieting0 阅读(690) 评论(0) 推荐(0) 编辑
摘要: // art-template // art-template 不仅可以在浏览器使用,也可以在 node 中使用 // 安装: // npm install art-template // 该命令在哪执行就会把包下载到哪里。默认会下载到 node_modules 目录中 // node_module 阅读全文
posted @ 2019-01-20 21:49 lujieting0 阅读(1284) 评论(0) 推荐(0) 编辑
摘要: var http = require('http') var fs = require('fs') var server = http.createServer() var wwwDir = 'D:/Movie/www' server.on('request', function (req, res 阅读全文
posted @ 2019-01-20 21:48 lujieting0 阅读(183) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 31 下一页