ECMAScript for XML Specification(Ecma-357)(4)
1. Let currentPrice be the result of calling the [[Get]] method of item with argument "price"
The second convention for accessing normal properties is expressed using the following notation:
- 5-
欧洲计算机制造商协会(ECMA)标准文档
object [ propertyName ]
When used on the left hand side of an assignment operation, this property access convention is equivalent to calling the Object [[Put]] method with object as the this object, passing ToString(propertyName) and the value from the right hand side of the assignment operator as arguments. For example, the following algorithm fragment:
1. Let item[1] = item2
is equivalent to the following algorithm fragment:
1. Call the Object [[Put]] method with item as the this object and arguments ToString(1) and item2
When used in other contexts, this property access convention is equivalent to calling the Object [[Get]] method with object as the this object and argument ToString(propertyName). For example, the following algorithm fragment:
1. Let item2 = item[1]
is equivalent to the following algorithm fragment:
1. Let item2 be the result of calling the Object [[Get]] method with item as the this object and argument
ToString(1)
This is a convenient and familiar notation for specifying numeric property names used as array indices.
The convention for accessing internal property names, including those that refer to internal methods, is specified using the following notation:
object . [[ internalPropertyName ]]
When used on the left hand side of an assignment operation, this property access convention is equivalent to setting the value of the [[ internalPropertyName ]] of the specified object to the value from the right hand side of the assignment operator. For example, the following algorithm fragment:
1. Let x.[[Class]] = "element"
is equivalent to the following algorithm fragment:
1. Let the value of the [[Class]] property of x be "element"
When used in other contexts, this property access convention is equivalent to getting the value of the [[internalPropertyName]] property of object. For example, the following algorithm fragment:
1. Let class = x.[[Class]]
is equivalent to the following algorithm fragment:
1. Let class be the value of the [[Class]] property of x
7.1.3 Iteration
This specification extends the notation used for describing ECMAScript Edition 3 by defining two iteration conventions. These iteration conventions are used by this specification for expressing that a set of steps shall be taken once for each item in a collection or once for each integer in a specified range.
The first iteration convention is defined for expressing a sequence of steps that shall be taken once for each member of a collection. It is expressed using the following for each notation: For each item in collection steps
This for each notation is equivalent to performing the given steps repeatedly with the variable item bound to each member of collection. The value of collection is computed once prior to performing steps and does not change while performing steps. The order in which item is bound to members of collection is implementation dependent. The repetition ends after item has been bound to all the members of collection or when the algorithm exits via a return or a thrown exception. The steps may be specified on the same line following a comma or on the following lines using the indentation style described in section . For example,
- 6-
欧洲计算机制造商协会(ECMA)标准文档
1. Let total = 0 2. For each product in groceryList
a. If product.price > maxPrice, throw an exception b. Let total = total + product.price
In this example, steps 2.a and 2.b are repeated once for each member of the collection groceryList or until an exception is thrown in line 2.a. The variable product is bound to the value of a different member of groceryList before each repetition of these steps.
The second iteration convention defined by this specification is for expressing a sequence of steps that shall be repeated once for each integer in a specified range of integers. It is expressed using the following for notation: For variable = first to last steps
This for notation is equivalent to computing first and last, which will evaluate to integers i and j respectively, and performing the given steps repeatedly with the variable variable bound to each member of the sequence i, i+1 … j in numerical order. The values of first and last are computed once prior to performing steps and do not change while performing steps. The repetition ends after variable has been bound to each item of this sequence or when the algorithm exits via a return or a thrown exception. If i is greater than j, the steps are not performed. The steps may be specified on the same line following a comma or on the following lines using the indentation style described above. For example,
1. For i = 0 to priceList.length-1, call ToString(priceList[i])
In this example, ToString is called once for each item in priceList in sequential order.
A modified version of the for notation exists for iterating through a range of integers in reverse sequential order. It is expressed using the following notation: For variable = first downto last steps
The modified for notation works exactly as described above except the variable variable is bound to each member of the sequence i, i-1, .. j in reverse numerical order. If i is less than j, the steps are not performed.
7.1.4 Conditional Repetition
This specification extends the notation used in the ECMAScript Edition 3 specification by defining a convention for expressing conditional repetition of a set of steps. This conv …… 此处隐藏:5794字,全部文档内容请下载后查看。喜欢就下载吧 ……
相关推荐:
- [资格考试]石油钻采专业设备项目可行性研究报告编
- [资格考试]2012-2013学年度第二学期麻风病防治知
- [资格考试]道路勘测设计 绪论
- [资格考试]控烟戒烟知识培训资料
- [资格考试]建设工程安全生产管理(三类人员安全员
- [资格考试]photoshop制作茶叶包装盒步骤平面效果
- [资格考试]授课进度计划表封面(09-10下施工)
- [资格考试]麦肯锡卓越工作方法读后感
- [资格考试]2007年广西区农村信用社招聘考试试题
- [资格考试]软件实施工程师笔试题
- [资格考试]2014年初三数学复习专练第一章 数与式(
- [资格考试]中国糯玉米汁饮料市场发展概况及投资战
- [资格考试]塑钢门窗安装((专项方案)15)
- [资格考试]初中数学答题卡模板2
- [资格考试]2015-2020年中国效率手册行业市场调查
- [资格考试]华北电力大学学习实践活动领导小组办公
- [资格考试]溃疡性结肠炎研究的新进展
- [资格考试]人教版高中语文1—5册(必修)背诵篇目名
- [资格考试]ISO9001-2018质量管理体系最新版标准
- [资格考试]论文之希尔顿酒店集团进入中国的战略研
- 全国中小学生转学申请表
- 《奇迹暖暖》17-支2文学少女小满(9)公
- 2019-2020学年八年级地理下册 第六章
- 2005年高考试题——英语(天津卷)
- 无纺布耐磨测试方法及标准
- 建筑工程施工劳动力安排计划
- (目录)中国中央空调行业市场深度调研分
- 中国期货价格期限结构模型实证分析
- AutoCAD 2016基础教程第2章 AutoCAD基
- 2014-2015学年西城初三期末数学试题及
- 机械加工工艺基础(完整版)
- 归因理论在管理中的应用[1]0
- 突破瓶颈 实现医院可持续发展
- 2014年南京师范大学商学院决策学招生目
- 现浇箱梁支架预压报告
- Excel_2010函数图表入门与实战
- 人教版新课标初中数学 13.1 轴对称 (
- Visual Basic 6.0程序设计教程电子教案
- 2010北京助理工程师考试复习《建筑施工
- 国外5大医疗互联网模式分析




