IES: JS-deck 14 Flashcards
1
Q
JS Operator “ %= “
A
- Performs the arithmetical operation on the two operands first
- Then assigns the results of that operation to the first variable - so that becomes its new stored value.
- Example: a%=b
- Equivalent: a=(a%b)
2
Q
JS Operator “ **= “
A
- Performs the arithmetical operation on the two operands first
- Then assigns the results of that operation to the first variable - so that becomes its new stored value.
- Example:
a**=b
- Equivalent:
a=(a**b)
3
Q
JS Operator “ === “
A
- Equality operator
- Compares values
- Compares if 2 operands are exactly equal (identical number values, identical characters, identical positions, identical data types, etc)
- JS is case sensitive: be aware character capitalization must match for equality
- The converse, the inequality operator “!==” employs the same rules
- Useful in comparing two values to perform “conditional branching,” where the script will follow a particular direction according to the results.
- Ex.
1. Be aware of differing data types
2. 25 === ‘25’ returns false
3. 25 == ‘25’ returns true
4
Q
JS Operator “ !== “
A
- Inequality operator
- Compares values
- Compares if 2 operands are not exactly equal (unidentical number values, unidentical characters, unidentical positions, unidentical data types, etc)
- JS is case sensitive: be aware character capitalization must match for equality
- Useful in comparing two values to perform “conditional branching,” where the script will follow a particular direction according to the results.
- The converse, the equality operator “===” employs the same rules
- Ex.
1. Be aware of differing data types
2. 25 !== ‘25’ returns true
3. 25 != ‘25’ returns false
5
Q
JS Operator “ == “
A
- checks for equality between two values
- Compares after performing type coercion, if necessary. (if operands are different types, JS attempts conversion to a common type before comparing)
- Useful in comparing two values to perform “conditional branching,” where the script will follow a particular direction according to the results.
- Ex.
1. 5 == “5” string
2. “5” converts to the number 5
3. Script comparison eval’s to true - Ex.
1. Be aware of differing data types
2. 25 == ‘25’ returns true
3. 25 === ‘25’ returns false
6
Q
JS Operator “ != “
A
- checks for inequality between two values
- Compares after performing type coercion, if necessary. (if operands are different types, JS attempts conversion to a common type before comparing)
- Useful in comparing two values to perform “conditional branching,” where the script will follow a particular direction according to the results.
- Ex.
1. 5 != “5” string
2. “5” converts to the number 5
3. Script comparison eval’s to true - Ex.
1. Be aware of differing data types
2. 25 != ‘25’ returns false
3. 25 !== ‘25’ returns true
7
Q
JS Operator “ > “
A
- “greater than” operator
- Compares 2 operands
- Returns true if the first is greater in value than the second
- Used frequently to test the value of a counter variable in a loop structure
- Conversely, the “less than” operator makes the same comparison but returns true when the first is less in value than the second
8
Q
JS Operator “ < “
A
- “less than” operator
- Compares 2 operands
- Returns true if the first is less in value than the second
- Used frequently to test the value of a counter variable in a loop structure
- Conversely, the “greater than” operator makes the same comparison but returns true when the first is greater in value than the second
9
Q
JS Operator “ >= “
A
- “greater than or equal to” operator
- Compares 2 operands
- Returns true : if the first is greater in value than the second or if the first is equal in value to the second
- [May be used frequently to test the value of a counter variable in a loop structure?]
- The converse is the “less than or equal to” operator
10
Q
JS Operator “ <= “
A
- “less than or equal to” operator
- Compares 2 operands
- Returns true : if the first is less in value than the second or if the first is equal in value to the second
- [May be used frequently to test the value of a counter variable in a loop structure?]
- The converse is the “greater than or equal to” operator
11
Q
JS Operator “ “
A
12
Q
JS Operator “ “
A
13
Q
JS Operator “ “
A
14
Q
JS Operator “ “
A
15
Q
JS Operator “ “
A
16
Q
JS Operator “ “
A
17
Q
JS Operator “ “
A
18
Q
JS Operator “ “
A
19
Q
JS Operator “ “
A
20
Q
JS Operator “ “
A