您好,欢迎访问一九零五行业门户网

javascript表达式有哪些

javascript表达式有:1、算术表达式;2、字符串表达式;3、主要表达;4、数组和对象初始化器表达式;5、逻辑表达式;6、左侧表达式;7、属性访问表达式;8、对象创建表达式;9、函数定义表达式;10、调用表达式等。
本文操作环境:windows7系统、javascript1.8.5版、dell g3电脑
javascript表达式有哪些?
表达式是可以求值并解析为值的代码单元。 js中的表达式可以分为几类。
算术表达式
字符串表达式
主要表达
数组和对象初始化器表达式
逻辑表达式
左侧表达式
属性访问表达式
对象创建表达式
函数定义表达式
调用表达式
算术表达式
在此类别下,取所有计算结果为数字的表达式:
1 / 2i++i -= 2i * 2
字符串表达式
计算结果为字符串的表达式:
'a ' + 'string'
主要表达
在此类别下,变量引用,文字和常量:
20.02'something'truefalsethis //the current objectundefinedi //where i is a variable or a constant
还有一些语言关键字:
functionclassfunction* //the generator functionyield //the generator pauser/resumeryield* //delegate to another generator or iteratorasync function* //async function expressionawait //async function pause/resume/wait for completion/pattern/i //regex() // grouping
数组和对象初始化器表达式
[] //array literal{} //object literal[1,2,3]{a: 1, b: 2}{a: {b: 1}}
逻辑表达式
逻辑表达式使用逻辑运算符并解析为布尔值:
a && ba || b!a
左侧表达式
new //create an instance of a constructorsuper //calls the parent constructor...obj //expression using the spread operator
属性访问表达式
object.property //reference a property (or method) of an objectobject[property]object['property']
对象创建表达式
new object()new a(1)new myrectangle('name', 2, {a: 4})
函数定义表达式
function() {}function(a, b) { return a * b }(a, b) => a * ba => a * 2() => { return 2 }
调用表达式
调用函数或方法的语法
a.x(2)window.resize()
推荐学习:《js基础教程》
以上就是javascript表达式有哪些的详细内容。
其它类似信息

推荐信息