![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JavaScript练习题
刘家军
但求卓越,不谋哗众
展开
-
JS数组练习题
1.将数组中数字的每一项相加求和let sum = 0;let arr = [1,5,89,5]arr.forEach(item =>{ sum = sum + item})console.log(sum)//1002.要求将数组中的0项去掉,将不为0的值存入一个新的数组,生成新的数组let arr = [4, 0, 7, 9, 0, 0, 2, 6, 0, 3, ...原创 2018-12-27 09:25:40 · 5770 阅读 · 0 评论 -
JavaScript常见面试题
1.考点:闭包var name = "window"var obj = { name: "obj", func:function(){ return function(){ return console.log(this.name) } } }obj.func()() // windowvar name = "wi...原创 2019-01-14 09:53:39 · 730 阅读 · 0 评论