04 2015 档案

摘要:1.Let's implement the reject() function...例:var odds = reject([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });=> [1, 3, 5]soluction:functio... 阅读全文
posted @ 2015-04-29 16:43 半岛弥情 阅读(230) 评论(0) 推荐(0)
摘要:对于这三个方法,我想一部分人还是比较陌生的。所以今天来个简单的介绍~我们可以将call()和apply()看作是某个对象的方法,通过调用方法的形式来间接调用函数。call()和apply()的第一个实参是要调用函数的母对象,在函数体内通过this来获得他的引用。简单例子:function test(... 阅读全文
posted @ 2015-04-29 15:20 半岛弥情 阅读(194) 评论(0) 推荐(0)
摘要:可参考Array.reduce用法1. 请编写getMissingElement函数,返回给定数组中缺少的元素(数组里的元素为0~9,只会缺失一个)。Example:getMissingElement( [0, 5, 1, 3, 2, 9, 7, 6, 4] ) // returns 8 getMi... 阅读全文
posted @ 2015-04-28 13:59 半岛弥情 阅读(373) 评论(0) 推荐(0)