js
文章平均质量分 96
苦笔
这个作者很懒,什么都没留下…
展开
-
js改变this指向的方法:call apply bind
在函数中使用thisfunction foo(c, d) { return this.a + this.b + c + d}global.a = 3global.b = 4// foo执行时,this没有明确的指向,默认指向全局对象global// nodejs中是global,browser中是windowfoo(3, 4) // 14...原创 2018-05-27 13:58:02 · 2252 阅读 · 0 评论 -
js中this的用法
浏览器全局环境(global context)this === window // true原创 2018-05-27 17:18:42 · 2627 阅读 · 0 评论 -
js 闭包(closure)
定义A closure is the combination of a function and the lexical environment within which that function was declared.This environment consists of any local variables that were in-scope at the time ...原创 2018-03-22 09:51:17 · 190 阅读 · 0 评论 -
es时间对象(Date)
1 定义// 4种定义方式new Date().toLocaleString(); // 2018-1-10 20:32:12// new Date(milliseconds),3年约等于11次方毫秒new Date(0).toLocaleString(); // 1970-1-1 08:00:00,不知道这是个什么日子new Date(1515原创 2018-01-11 22:18:55 · 5238 阅读 · 1 评论 -
JS中数值常量的含义,数值的运算
Number.MAX_VALUENumber.MIN_VALUENumber.MAX_SAFE_INTEGERNumber.MIN_SAFE_INTEGERNumber.EPSILONES采用Binary640.1 + 0.2 =原创 2018-10-25 19:41:10 · 1256 阅读 · 0 评论