Created
June 11, 2017 13:39
-
-
Save Ncreshon/e4ad5d7426b176061b29bf289475a79a to your computer and use it in GitHub Desktop.
JS Bin[Operators]// source https://jsbin.com/bacahig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Operators// | |
| /* Assignment Operators assign the value of the operand to the | |
| * right of the operand on the left = */ | |
| var a = 1; | |
| // Arithmetic Operators// | |
| /* Arithmetic operators perform mathmatical operations on | |
| * operands and return a result*/ | |
| console.log(2 + 2); // + addition// | |
| console.log(2 - 2); // - subtraction// | |
| console.log(2 * 2); // * multiplication// | |
| console.log(2 / 2); // / division// | |
| console.log(2 % 2); // % modulus (returns remainder)// | |
| console.log(++a); // ++ increment increase by 1 before increases/ | |
| //immediately after increases after value is passed// | |
| console.log(--a); // -- decrement decreases by 1 before increases | |
| //immediatly. After decreses after value is passed// | |
| //Comparison Operators// | |
| /* Comparison operators test for equality or difference between | |
| * operands and return a Boolean true or false*/ | |
| console.log(3 == "3"); // Equality// | |
| console.log( 3 != 3); // Inequality // | |
| console.log(3 === "3"); // Strict Equality considers data types// | |
| console.log(3 !== "3"); // Strict Ineqality considers data type// | |
| console.log(3 > 4); // Greater than// | |
| console.log(3 < 4); //Less than// | |
| console.log(3 >= 4); // Greater than or Equal to// | |
| console.log(3 <= 4); //Less than or Equal to// | |
| //Logical Operators// | |
| /* Logical operators ecaluate a logical expression for thruthiness | |
| * or falseness | |
| * && AND return the 1st operand if it is true. If false returns the 2nd*/ | |
| /*|| OR returns the 1st operand if it is true. If false returns the | |
| * 2nd operand*/ | |
| /* ! NOT or Bang takes only 1 operand. Returns false if it's operand can be | |
| * converted to true. If not it returns false. | |
| //Binary// | |
| /* Binary operators take on 2 operands// | |
| //Unary// | |
| /* Unary operators take on 1 operand such as (!) The Bang and typeOf | |
| * typeOf returns the type of data it is. There is exceptions to this rule. | |
| * Somethings like date, array, and null will return object as their type. | |
| * To test an array type you would use Array.isArray(value) | |
| *To test date you would use instanceof | |
| *delete deletes an object or property or a element of an array*/ | |
| //Ternary // | |
| /* Ternary operator is alson know as the conditional operator. | |
| * It uses three operands. It evalutes a logical expression and returns a | |
| * value based on wheather that expression is true or false. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment