javascript表达式有哪些
时间:2022-02-11 17:27
javascript表达式有:1、算术表达式;2、字符串表达式;3、主要表达;4、数组和对象初始化器表达式;5、逻辑表达式;6、左侧表达式;7、属性访问表达式;8、对象创建表达式;9、函数定义表达式;10、调用表达式等。 本文操作环境:Windows7系统、javascript1.8.5版、DELL G3电脑 javascript表达式有哪些? 表达式是可以求值并解析为值的代码单元。 JS中的表达式可以分为几类。 算术表达式 字符串表达式 主要表达 数组和对象初始化器表达式 逻辑表达式 左侧表达式 属性访问表达式 对象创建表达式 函数定义表达式 调用表达式 算术表达式 在此类别下,取所有计算结果为数字的表达式: 字符串表达式 计算结果为字符串的表达式: 主要表达 在此类别下,变量引用,文字和常量: 还有一些语言关键字: 数组和对象初始化器表达式 逻辑表达式 逻辑表达式使用逻辑运算符并解析为布尔值: 左侧表达式 属性访问表达式 对象创建表达式 函数定义表达式 调用表达式 调用函数或方法的语法 推荐学习:《js基础教程》 以上就是javascript表达式有哪些的详细内容,更多请关注gxlsystem.com其它相关文章!1 / 2
i++
i -= 2
i * 2
'A ' + 'string'
2
0.02
'something'
true
false
this //the current object
undefined
i //where i is a variable or a constant
function
class
function* //the generator function
yield //the generator pauser/resumer
yield* //delegate to another generator or iterator
async function* //async function expression
await //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 && b
a || b
!a
new //create an instance of a constructor
super //calls the parent constructor
...obj //expression using the spread operator
object.property //reference a property (or method) of an object
object[property]
object['property']
new object()
new a(1)
new MyRectangle('name', 2, {a: 4})
function() {}
function(a, b) { return a * b }
(a, b) => a * b
a => a * 2
() => { return 2 }
a.x(2)
window.resize()