Javascript operators


// Vergleichoperatoren || Comparison Operators
var a = 5, b = 10;

Greater than				if(a > b){...} 		// false
Less than					if(a < b){...} 		// true
Greater than or equal to	if(a >= b){...}		// false
Less than or equal to 		if(a <= b){...}		// true
Equal to 					if(a == b){...}		// false
Not equal					if(a != b){...}		// true

// Prüfung auf strikte Geichheit  || Strict Comparison Operators
var a = 5, b = "5";

Equal to 							if(a == b){...} 	// true
Equal value and equal type 			if(a === b){...} 	// false a --> int,  b --> String
Not equal value OR not equal type	if(a !== b){...} 	// true  

// Logische Operatoren || Logical Operators
var a = 5, b = 5, c = 5, d = 10;

AND		if(a == b && c == d) {...} 	// false  --> Both conditions must be met
OR		if(a == b || c == d) {...}  // true	 --> Only one of the two conditions should meet
NOT		if(!(a > d)) {...}			// true  --> a > d is not true, hence the condition is fulfilled 

// Arithmetische Operatoren || Arithmetic Operators
var a = 14, b = 5, c = "Hello", d = "World!";

Addition		a + b 		// 19 	(int)
Subtraction		a - b 		// 9	(int)
Multiplication	a * b 		// 70	(int)
Division		a / b 		// 2.8 	(float)
Modulus 		a % b 		// 4	(int)
Increment		a++			// 15	(int)
Decrement		a--			// 13	(int)

*** Warning! *** 
Concatenation	b + c 		// 5Hello 		(String)
				c + d 		// HelloWorld!	(String)
				c + " " + d // Hello World!	(String)
				
// Conditional (Ternary) Operator

Syntax
variablename = (condition) ? true:false;

var age = 29, type;
type = (age < 18) ? "Minor" : "Adult";	// Adult



0
1