prototype1.4简介_yj
Prototype 没有太重要的作用,只是声明了该程序包的版本 。
5.4.2 The Enumerable object
Enumberable对象能够已更优雅的方式实现对列表样式的结构进行枚举。 很多其它的对象通过扩展自Enumberable对象来得到这些有用的接口。
prototype1.4简介_yj
pattern: a RegExp object grep(pattern iterator]) [, used to match the elements, instance iterator: a function object conforming Function(value, index) include(obj) instance obj: any object initialValue: any object to be used as the initial value, inject(initialValue, iterator) instance iterator: a function object conforming Function(accumulator, value, index) methodName: name of the to to
用 pattern 参数正则表达式测试集合中的每 个元素, 返回一个包含所有匹配正则式的元 素的 Array, 如果给出了 Iterator, 那个每个 结果还要经过一下
Iterator 处理. 判断集合中包不包含指定对象. 用 Iterator 联接所有集合中的元素. Iterator 在被调用时把上一次迭代的结果做为第一 个参数传给 accumulator.第一次迭代时, accurmelator 等 于 initialValue, 最 后 返 回 accumulator 的值.
method that will be called in 集合中的每个元素调用指定的函数 (查看源 invoke(methodName [, arg1 [, arg2 [...]]]) instance each element, arg1..argN: 代码可以发现指定函数被调用时,this 指针 arguments passed in that the will ,并传入给出的参数,返 be 被传成当前元素) method 回调用结果组成的 Array.
invocation. iterator: a function object map(iterator) instance conforming Function(value, index) iterator: a function object 返回集合中元素的最大值,或调用 Iterator max([iterator]) instance conforming Function(value, index) member(obj) instance obj: any object iterator: a function object min([iterator]) instance conforming Function(value, index) 返回一个包含两个 Array 的 Array,第一个 iterator: a function object Array 包含所有调用 Iterator 返回 True 的元 partition([iterator]) instance conforming Function(value, index) to 素,第二个 Array 包含剩下的元素.如果 Iterator 没有给出,那么就根据元素本身判 断. propertyName name of the property that will be read pluck(propertyName) instance from each element. This can also contain the index of the element iterator: a function object reject(iterator) instance conforming Function(value, index) select(iterator) instance iterator: a function object 同 findAll(). to 和 findAll()相反(返回所有等于 false 的元 素). 返回每个元素的指定属性名的属性的值组 成的 Array. to 返回最小值,参见 max(). to 后返回值的最大值(如果给出了 Iterator 的 话). 同 include(). to 同 collect().
prototype1.4简介_yj
5.4.3 The Hash object
Hash对象实现一种Hash结构,也就是一个Key:Value对的集合。
Hash中的每个Item是一个有两个元素的array,前一个是Key,后一个是Value,每个Item也有两个不需加以说明的属性,key和value。
5.4.4 The ObjectRange class 继承自 Enumerable
用上、下边界描述一个对象区域。
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库prototype1.4简介_yj(17)在线全文阅读。
相关推荐: