随笔分类 -  js

摘要:// this 代表的是函数前边那个点左边的那个东西 Student.prototype.update = function(name, sexy) { this.name = name this.sexy = sexy}var obj = new Student(); // 此时 this 代表的 阅读全文
posted @ 2018-07-26 12:00 mojito1996 阅读(103) 评论(0) 推荐(0)
摘要:一个js文件中,包含多个函数,应该只有一个调用,例如: 阅读全文
posted @ 2018-07-17 12:21 mojito1996 阅读(134) 评论(0) 推荐(0)
摘要:var fun = function(x) { if (x < 1) { return x; } else { return -x; } } // 自动测试 function ensure(condition, message) { if (!condition) { console.log(message) } } // 运行testFun(),发现结果不符自动输出错误... 阅读全文
posted @ 2018-07-17 11:51 mojito1996 阅读(129) 评论(0) 推荐(0)
摘要:console.log() 显示运行路径/显示相关参数 阅读全文
posted @ 2018-07-16 16:32 mojito1996 阅读(76) 评论(0) 推荐(0)