JavaScript Comparison and Logical Operators

Comparison and Logical operators are used to test for true or false. Comparison Operators Comparison operators are used in logical statements to determine equality or difference between variables or values. Given that x = 5, the table below explains the comparison operators: Operator Description Comparing Returns Try it == equal to x == 8 false Try it » x […]

JavaScript Operators

Example Assign values to variables and add them together: var x = 5;         // assign the value 5 to x var y = 2;         // assign the value 2 to y var z = x + y;     // assign the value 7 to z (x + y) Try it Yourself » The assignment operator (=) assigns a value to a variable. Assignment var x = 10; Try […]