language syntax Flashcards
(71 cards)
javascript types
Primitives: - number - string - boolean - null - undefined Objects: - global object - object - array - function (including constructors) - date - regexp - error
javascript type categories
- primitive vs. object
- with methods vs. without methods
- mutable vs. inmutable
var
variable declaration
overflow
the result of a numeric operation is larger than the largest representable number, negative or positive, resulting in the return of Infinity or -Infinity
underflow
occurs when the result of a numeric operation is closer to zero than the smallest representable number, resulting in a return of zero or negative zero
monetary values
manipulate monetary values as integer cents rather than fractional dollars
\n
escape sequence for newline
'
escape sequence for single quote
\u
escape sequence for unicode characters
+
string concatenation overloaded operator
string.length
returns the length of a string in 16bit values (note, some characters are more than 16bits)
string.charAt(x)
returns the character at the index given
string.substring(x,y)
returns characters between x and y
string.slice(x) or string.slice(x,y)
returns the characters between x and y, or x number of characters
string.indexOf(x)
returns index of given character
string.lastIndexOf(x)
returns index of last occurrence of given character
string.split(“x”)
split string into substrings
string.replace(x, y)
replace x for y on all instances
string.toUpperCase()
all characters in string to uppercase
immutable strings
in js strings are immutable. Methods like .replace() and .toUpperCase() return new strings
string[x]
return character at position x
/^HTML/
regular expression example - expression is indicated between two forward slashes
RegExp()
constructor for regular expressions
string.test(text)
string method for finding text pattern - returns true if matched