Wednesday, 6 January 2016

Java script 3

JavaScript Arithmetic Operators

Operator Description
 +                  Addition
 -                 Subtraction
 *                 Multiplication
 /                 Division
 %                 Modulus
 ++                 Increment
 --                 Decrement

 

JavaScript Assignment Operators

Operator Example
=                  x = y
+=                  x += y
-=                  x -= y
*=                  x *= y
/=                  x /= y
%=                 x %= y

 

JavaScript  Logical Operators

OperatorDescription
= =                            equal to
= = =                              equal value and equal type
!=                            not equal
!==                            not equal value or not equal type
>                            greater than
<                            less than
>=                            greater than or equal to
<=                            less than or equal to
?                             ternary operator

 

JavaScript Function Syntax

 function name(parameter1, parameter2, parameter3)

 {
    code to be executed

 

 Example:

var x = myFunction(5, 2);        // Function is called, return value will end up in x
function myFunction(a, b)

 {
    return a * b;                // Function returns the product of a and b }

 






















































































































 
































































No comments:

Post a Comment