First, JavaScript operators
Operator
-Arithmetic operation +-*/% + +--
-Relational Operations > < >= <= = = = = = = =!==
-Logic Operations && | | !
-Bit Arithmetic & | ~ ^ << >> >>>
-Assignment operation = + = = *=/=%=
-Character JOIN Operation +
-Condition (trinocular) operation?:
-Special operator typeof instanceof void Delete
1. Arithmetic arithmetic
Arithmetic operators
-Add (+), subtract (-), multiply (*), divide (/), seek remainder (%)
--can represent a minus sign, or a minus sign, such as: x=-y
-+ can represent addition, can also be used for string connection
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7D/F7/wKiom1bzq9DSNN8CAACMnpY0_-g138.png "title=" Web.png "alt=" Wkiom1bzq9dsnn8caacmnpy0_-g138.png "/>
Using the% operator
-% means to find the remainder operation
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7D/F3/wKioL1bzrP_RPq-fAADLBzASBWg274.png "title=" Web.png "alt=" Wkiol1bzrp_rpq-faadlbzasbwg274.png "/>
Using the "+ +" and "--" operators
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7D/F3/wKioL1bzrd2i1BR3AACu23QFhdo856.png "title=" Web.png "alt=" Wkiol1bzrd2i1br3aacu23qfhdo856.png "/>
2. Relational operations
Using relational operators
-relational operations are used to determine the size relationship between data
-">" (Greater Than), "<" (less than), ">=" (greater than or equal), "<=" (less than equals), "= =" (equals), "! =" (Not equal to)
-The value of the relational expression is a Boolean type ("true" or "false")
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7D/F3/wKioL1bzspTCJrtbAACuPRnDzRo186.png "title=" Web.png "alt=" Wkiol1bzsptcjrtbaacuprndzro186.png "/>
-congruent: = = =
-Same type
-Same value
-Not congruent:! ==
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7D/F7/wKiom1bzsrPQlf4pAADRzY90rqc458.png "title=" Web.png "alt=" Wkiom1bzsrpqlf4paadrzy90rqc458.png "/>
IsNaN function
-IsNaN ()
-Used to determine whether its argument is a "non-numeric (NaN)" Value
-If the result of Nan compared to any value (including itself) is false, then to determine whether a value is Nan, you cannot use the = = or = = = operator, in which case you can only use the isNaN () function
-typically used to detect the operation results of a type conversion function to determine whether they represent a valid number
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7D/F4/wKioL1bztFWyQe6gAAE4J6Gmb_0260.png "title=" Web.png "alt=" Wkiol1bztfwyqe6gaae4j6gmb_0260.png "/>
3. Logical operation
Logical operations
-Logic and (&&), logic or (| |), logical non (!)
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7D/F4/wKioL1bztYKBHLdSAAEFi5ohol4073.png "title=" Web.png "alt=" Wkiol1bztykbhldsaaefi5ohol4073.png "/>
Logic and (&&) operations
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7D/F4/wKioL1bzthvAloMEAAGNwC60LIU709.png "title=" Web.png "alt=" Wkiol1bzthvalomeaagnwc60liu709.png "/>
Logic or (| |) Operation
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7D/F7/wKiom1bzteehm3S1AAFoi-QNntc173.png "title=" Web.png "alt=" Wkiom1bzteehm3s1aafoi-qnntc173.png "/>
Logical NON (!) Operation
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7D/F4/wKioL1bztsKBHEG_AAFtoyWYXTk433.png "title=" Web.png "alt=" Wkiol1bztskbheg_aaftoywyxtk433.png "/>
Questions about "Short circuit logic"
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7D/F7/wKiom1bztmrD5oPuAAFDWi0ImCE723.png "title=" Web.png "alt=" Wkiom1bztmrd5opuaafdwi0imce723.png "/>
4, bit arithmetic
Bit arithmetic
-bitwise operations, which operate on numbers in binary form
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7D/F7/wKiom1bzttiyABQfAABWQGO-Pk4442.png "title=" Web.png "alt=" Wkiom1bzttiyabqfaabwqgo-pk4442.png "/>
5. Assignment operation
Use "=" for assignment operations
-"=" To assign a value to a variable
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7D/F4/wKioL1bzt_HRPDMZAACbmbFBmz4577.png "title=" Web.png "alt=" Wkiol1bzt_hrpdmzaacbmbfbmz4577.png "/>
Using an extended assignment expression
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7D/F7/wKiom1bzt67j1leSAAGv1HUXoFY665.png "title=" Web.png "alt=" Wkiom1bzt67j1lesaagv1huxofy665.png "/>
6, character connection operation
Use "+" for string connections
-"+" acts on two numbers, which means arithmetic
-"+" when acting on strings, representing string concatenation operations
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7D/F4/wKioL1bzuPjwIcSIAAFv2x9qS9g142.png "title=" Web.png "alt=" Wkiol1bzupjwicsiaafv2x9qs9g142.png "/>
7. Condition (trinocular) operation
Use condition (trinocular) operator
-Three mesh operator (?:) -----need to perform an operation on three expressions
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7D/F4/wKioL1bzucCROPdpAABAt9_QG54942.png "title=" Web.png "alt=" Wkiol1bzuccropdpaabat9_qg54942.png "/>
Where the value of expression 1 should be a Boolean type, the meaning of the expression:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7D/F4/wKioL1bzugbAu2UsAAGIVUd90Rs384.png "title=" Web.png "alt=" Wkiol1bzugbau2usaagivud90rs384.png "/>
Use condition (trinocular) operator
-In a conditional operation expression, each expression can be another conditional operation expression, called a nesting of conditional operations
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7D/F7/wKiom1bzueiyqIXMAAB7737EMCY367.png "title=" Web.png "alt=" Wkiom1bzueiyqixmaab7737emcy367.png "/>
Summary: This chapter focuses on JavaScript operators, expressions
This article from the "Technical Exchange" blog, declined reprint!
JavaScript basics -4 JavaScript operators, expressions