javascript-operators-and-expressions Flashcards
What data type is returned by an arithmetic operation?
The data type that is returned by an arithmetic operation is a number. This is the case even if the result is NaN.
What is string concatenation?
String concatenation is when two strings are combined with a plus operator or a string and the plus operator with another variable adds the string form of the variable to the string being added too. Strings are immutable so taking the index of a character in a string and changing it will not actually change the original string.
What purpose(s) does the + plus operator serve in JavaScript?
The purpose of the (+) plus operator is to add numbers/bigints together with addition, to combine strings, or to convert another variable to a string and add it to the start of end of a string.
What data type is returned by comparing two values (<, >, ===, etc)?
The data type that is returned by comparing two values is either true or false. These values are of the type boolean.
What does the += “plus-equals” operator do?
The += “plus-equals” operator takes the variable on the left and adds the thing on the right of the assignment operator to it. It is equivalent to: num = num + 2; || num += 2;