Created
July 23, 2017 21:52
-
-
Save LindseyCason/9c388d141cda9ee03832fc623fa216a6 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/culibud
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
/*Operators: | |
* | |
*In JavaScript there are various types of operators that perform a variety | |
*of operations. | |
* | |
*/ | |
/* | |
Assignment Operator: | |
The assignment operator assigns the value to the right of the operator | |
to the operand on the left of the operator. | |
ex. | |
var x = 123; // this assigns 123 to var x. | |
var x = "John"; // this assigns "John" to var x. | |
*/ | |
/* | |
Comparison Operators: | |
Comparison operators compare the operands and return a value based | |
on whether the comparison is true. The operands can be numbers, | |
strings, logic, or object values. | |
(==) Equal // returns true if the operands are equal. | |
(!=) Not Equal // returns true if the operands are not equal. | |
(===) Strict Equal // Returns true if the operands are equal and of the same type. | |
(!==) Strict Not Equal // Returns true if the operands are of the same type but not | |
// equal, or are of different type. | |
(>) Greater than // Returns true if the left operand is greater than the right operand. | |
(>=) Greather than or equal // Returns true if the left operand is greater than or | |
//equal to the right operand. | |
(<) Less than // Returns true if the left operand is less than the right operand. | |
(<=) Less than or equal to // Returns true if the left operand is less than or equal | |
// to the right operand. | |
*/ | |
/*Arithmetic Operators: | |
An arithmetic operator takes a numerical value as their operands and returns | |
a single numerical value. | |
(+) addition // returns the sum of the operands. | |
(-) subtraction // returns the difference of the operands. | |
(*) multiplication // returns the product of the operands. | |
(/) division // returns the quotient of the operands | |
(%) remainder // returns the remainder of dividing the two operands. | |
(++) increment // Adds one to the operand. | |
(--) decremet // Subtracts one from its operand. | |
(-) unary negation // Returns the negation of its operand. | |
(+) unary plus // Attempts to convert the operand to a number. | |
(**) exponentiation // Calculates the base to the exponent power. | |
Logical Operators: | |
Logical Operators are usually used with Boolean values and if they | |
are, they return Boolean values. However the && and || actually return | |
the value of one of the specified operands, so if these operands | |
are used with non-Boolean values, they may return a non-Boolean | |
value. | |
(&&) logical AND // returns true only if BOTH operands are true. | |
(||) logical OR // returns true if one of the operands is true. | |
(!) logical NOT // returns false if its single operand can be converted | |
// to true; otherwise it returns true. | |
Unary Operators: | |
A unary operator requires a single operand before or after the operator. | |
ex. | |
i++ or ++i | |
Binary Operators: | |
A binary operator requires one operand before the operator and one | |
after the operator. | |
ex. | |
2 + 3 | |
Ternary Operator: | |
The only ternary operator is the conditional operator. This takes three operands. | |
The operator can have one of two values based on a condition. | |
var temp = (60 > 90) ? "hot" : "cold"; // returns "cold" | |
*/ | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">/*Operators: | |
* | |
*In JavaScript there are various types of operators that perform a variety | |
*of operations. | |
* | |
*/ | |
/* | |
Assignment Operator: | |
The assignment operator assigns the value to the right of the operator | |
to the operand on the left of the operator. | |
ex. | |
var x = 123; // this assigns 123 to var x. | |
var x = "John"; // this assigns "John" to var x. | |
*/ | |
/* | |
Comparison Operators: | |
Comparison operators compare the operands and return a value based | |
on whether the comparison is true. The operands can be numbers, | |
strings, logic, or object values. | |
(==) Equal // returns true if the operands are equal. | |
(!=) Not Equal // returns true if the operands are not equal. | |
(===) Strict Equal // Returns true if the operands are equal and of the same type. | |
(!==) Strict Not Equal // Returns true if the operands are of the same type but not | |
// equal, or are of different type. | |
(>) Greater than // Returns true if the left operand is greater than the right operand. | |
(>=) Greather than or equal // Returns true if the left operand is greater than or | |
//equal to the right operand. | |
(<) Less than // Returns true if the left operand is less than the right operand. | |
(<=) Less than or equal to // Returns true if the left operand is less than or equal | |
// to the right operand. | |
*/ | |
/*Arithmetic Operators: | |
An arithmetic operator takes a numerical value as their operands and returns | |
a single numerical value. | |
(+) addition // returns the sum of the operands. | |
(-) subtraction // returns the difference of the operands. | |
(*) multiplication // returns the product of the operands. | |
(/) division // returns the quotient of the operands | |
(%) remainder // returns the remainder of dividing the two operands. | |
(++) increment // Adds one to the operand. | |
(--) decremet // Subtracts one from its operand. | |
(-) unary negation // Returns the negation of its operand. | |
(+) unary plus // Attempts to convert the operand to a number. | |
(**) exponentiation // Calculates the base to the exponent power. | |
Logical Operators: | |
Logical Operators are usually used with Boolean values and if they | |
are, they return Boolean values. However the && and || actually return | |
the value of one of the specified operands, so if these operands | |
are used with non-Boolean values, they may return a non-Boolean | |
value. | |
(&&) logical AND // returns true only if BOTH operands are true. | |
(||) logical OR // returns true if one of the operands is true. | |
(!) logical NOT // returns false if its single operand can be converted | |
// to true; otherwise it returns true. | |
Unary Operators: | |
A unary operator requires a single operand before or after the operator. | |
ex. | |
i++ or ++i | |
Binary Operators: | |
A binary operator requires one operand before the operator and one | |
after the operator. | |
ex. | |
2 + 3 | |
Ternary Operator: | |
The only ternary operator is the conditional operator. This takes three operands. | |
The operator can have one of two values based on a condition. | |
var temp = (60 > 90) ? "hot" : "cold"; // returns "cold" | |
*/ | |
</script></body> | |
</html> |
This file contains 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: | |
* | |
*In JavaScript there are various types of operators that perform a variety | |
*of operations. | |
* | |
*/ | |
/* | |
Assignment Operator: | |
The assignment operator assigns the value to the right of the operator | |
to the operand on the left of the operator. | |
ex. | |
var x = 123; // this assigns 123 to var x. | |
var x = "John"; // this assigns "John" to var x. | |
*/ | |
/* | |
Comparison Operators: | |
Comparison operators compare the operands and return a value based | |
on whether the comparison is true. The operands can be numbers, | |
strings, logic, or object values. | |
(==) Equal // returns true if the operands are equal. | |
(!=) Not Equal // returns true if the operands are not equal. | |
(===) Strict Equal // Returns true if the operands are equal and of the same type. | |
(!==) Strict Not Equal // Returns true if the operands are of the same type but not | |
// equal, or are of different type. | |
(>) Greater than // Returns true if the left operand is greater than the right operand. | |
(>=) Greather than or equal // Returns true if the left operand is greater than or | |
//equal to the right operand. | |
(<) Less than // Returns true if the left operand is less than the right operand. | |
(<=) Less than or equal to // Returns true if the left operand is less than or equal | |
// to the right operand. | |
*/ | |
/*Arithmetic Operators: | |
An arithmetic operator takes a numerical value as their operands and returns | |
a single numerical value. | |
(+) addition // returns the sum of the operands. | |
(-) subtraction // returns the difference of the operands. | |
(*) multiplication // returns the product of the operands. | |
(/) division // returns the quotient of the operands | |
(%) remainder // returns the remainder of dividing the two operands. | |
(++) increment // Adds one to the operand. | |
(--) decremet // Subtracts one from its operand. | |
(-) unary negation // Returns the negation of its operand. | |
(+) unary plus // Attempts to convert the operand to a number. | |
(**) exponentiation // Calculates the base to the exponent power. | |
Logical Operators: | |
Logical Operators are usually used with Boolean values and if they | |
are, they return Boolean values. However the && and || actually return | |
the value of one of the specified operands, so if these operands | |
are used with non-Boolean values, they may return a non-Boolean | |
value. | |
(&&) logical AND // returns true only if BOTH operands are true. | |
(||) logical OR // returns true if one of the operands is true. | |
(!) logical NOT // returns false if its single operand can be converted | |
// to true; otherwise it returns true. | |
Unary Operators: | |
A unary operator requires a single operand before or after the operator. | |
ex. | |
i++ or ++i | |
Binary Operators: | |
A binary operator requires one operand before the operator and one | |
after the operator. | |
ex. | |
2 + 3 | |
Ternary Operator: | |
The only ternary operator is the conditional operator. This takes three operands. | |
The operator can have one of two values based on a condition. | |
var temp = (60 > 90) ? "hot" : "cold"; // returns "cold" | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment