Javascript Flashcards
What are the 6 types of values in JavaScript?
Numbers, Strings, Booleans, Objects, Functions, Undefined
What type of operator is this: =
Assignment operator, Assigns value to a variable
What type of operator is this: +
Addition operator, adds values
What type of operator is this: -
Subtraction operator, subtracts values
What type of operator is this: /
Division operator, divides values
What type of operator is this: %
Remainder operator, divides values and gives back the remainder.
Example: 27 % 16 = 11. Because 27 / 16 = 1 with a remainder of 11.
What type of operator is this: ++
Increment operator, adds 1 to its operant and returns the value
What operator is this: –
Decrement operator, subtracts 1 from its operant and returns the value
What is an operand?
An operand is a value that is being acted upon by an operator
String
Used to represent text. Written in quote marks.
Ex: “This is a string”
\ ~In the context of a string~
Escaping. This signifies in a string that the next character is important.
Ex: “This is a "quote"”
Result: This is a “quote”
\n
New line
Ex: “Hello Top \nHello Bottom”
Result: Hello Top
Hello Bottom
\t
Tab in a string.
\
Backslash in a string
"
Quote marks in a string.
Concatenation
Adding strings together.
Ex: “Con” + “cat” + “e” + “nate”
Result: Concatenate
Boolean Values
Values that are true or false.
Comparison operators
> Greater than < Less than >= Greater than or equal to <= less than or equal to == equal value === equal value and type != not equal to
True or false? Strings can be compared using comparison operators?
Kind of true. They can be compared in alphabetical order based on the Unicode order.
Logical Operators
And (&&), Or(||), Not(!)
And operator
&&
Result is true if both values are true
Or operator
||
Result is true if either value is true.
Not operator
!
Result is flipped.
Ex:
!true = false
Ex2:
!false = true
True or False: Undefined and Null are essentially the same.
True