Expressions and Statemen
来源:互联网 发布:教学视频的软件 编辑:程序博客网 时间:2024/06/07 15:40
JavaScript 两个最重要的概念表达式和语句
表达式概念:An expression is a phrase of JavaScript that a JavaScript interpreter can evaluate to produce a a value.
表达式的分类:
1.Primary Expressions
1 "hi word" 2 /pattern/ 3 4 //some of JavaScript reserved word are primary expressions 5 true 6 false 7 null 8 this //Evaluates to the "current" object 9 10 //finally the third type of primary expressions is the bare variable reference11 I12 sum13 undefined // undefined is a global variable ,not like null.
2.Object and Array Initalizers
1 // Array initializer2 [1,5,2,6,5]3 4 // Object initializer5 {x:2,y3}
3. Function Definition Expressions
1 //*function expression2 function(x) { return x*x }3 4 //* function statement 5 function foo(){6 console.log("bar");7 };
4.Property Access expression & Invoication expression & Object Creation expression
1 //Property Access expression 2 var o={x:1,y:{z:3}} 3 var a=[o,1,4,[5,6]] 4 5 o.x //property x of expression o 6 o["y"] //property x of expression o 7 a[1] //element at index 1 of object o 8 a[0].x // property x of expression a[0] 9 10 //Invocation expression11 foo(1,2)12 a.sort()13 Math.max(x,y,z)14 15 //object creation expression16 new Object()17 new Point(2,3)
5.Arithmetic Expression & Logical Expression & Assignment Expression
1 //Arithmetic 2 1+1 3 2*5 4 3-4 5 6%9 6 5-- 7 6++ 8 9 //Logical10 7&811 7<<212 ^0x0f13 // Assignment14 I=615 o.x=216 17 x +=x+118 .......
语句概念:statements are JavaScript sentences or commands;Expressions are evaluated to produce a value, but statements are
executed to make something happen.
语句的分类:
0 0
- Expressions and Statemen
- Expressions and Statemen
- Expressions and Statemen
- Strings and Regular Expressions
- XPath and Regular Expressions
- Constexpr and Constant Expressions
- words and expressions from friends
- Friends: New words and expressions
- Chapter 3 - Variables and Expressions
- Python en:Operators and Expressions
- Statements and Declarations in Expressions
- Expressions and phases for writing
- 12.3.3.21 Invocation expressions and object creation expressions
- Regular Expressions and the Java Programming Language
- Arithmetic: Creating Expressions With Variables And Operators
- DataTable and DataColumn Expressions in ADO.NET
- Python基础(1) - Numbers and Expressions
- Parsing arithmetic expressions - Bison and Flex
- Java反射获取get和set方法
- 常用WEB服务器的特点介绍
- 关于mysql5.6表名小写无法改大写的解决方案
- 设计模式之七个结构型模式的相关知识,简单易懂。
- 类加载,相关代码
- Expressions and Statemen
- 几本推荐的Java书
- c++中ifstream一次读取整个文件
- 企业公众号都离不开的四种运营模式
- 外挂学习之路(11)--- 背包数据的遍历
- 如何使用TransitionDrawable实现背景切换渐变效果
- 火遍大江南北的前端面试题[JavaScript]
- 多线程_线程调度及获取和设置线程优先级
- SDUT 3779 小Hao的播放器