In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what the javascript expression is. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Javascript expressions are: 1, arithmetic expression; 2, string expression; 3, main expression; 4, array and object initializer expression; 5, logical expression; 6, left expression; 7, attribute access expression; 8, object creation expression; 9, function definition expression; 10, calling expression, etc.
This article operating environment: Windows7 system, javascript1.8.5 version, DELL G3 computer
An expression is a unit of code that can be evaluated and resolved to a value. Expressions in JS can be divided into several categories.
Arithmetic expression
String expression
Main expression
Array and object initializer expressions
Logical expression
Left expression
Attribute access expression
Object creation expression
Function definition expression
Invocation expression
Arithmetic expression
Under this category, take all expressions that evaluate to numbers:
1 / 2i++i-= 2i * 2
String expression
Expression that evaluates to a string:
'A'+ 'string'
Main expression
Under this category, variable references, literals, and constants:
20.02'something'truefalsethis / / the current objectundefinedi / / where i is a variable or a constant
There are also some language keywords:
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 and object initializer expressions
[] / / array literal {} / / object literal [1,2,3] {a: 1, b: 2} {a: {b: 1}}
Logical expression
Logical expressions use logical operators and resolve to Boolean values:
A & & ba | | bachela
Left expression
New / / create an instance of a constructorsuper / / calls the parent constructor...obj / / expression using the spread operator
Attribute access expression
Object.property / / reference a property (or method) of an objectobject [property] object ['property']
Object creation expression
New object () new a (1) new MyRectangle ('name', 2, {a: 4})
Function definition expression
Function () {} function (a, b) {return a * b} (a, b) = > a * ba = > a * 2 () = > {return 2}
Invocation expression
Syntax for calling a function or method
A.X (2) window.resize () on "what is a javascript expression" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.