Operators and Functions Flashcards
Increment and decrement unary operators can be used [..] and [..]
Prefix and postfix
Using [..] on an array replaces the value with ‘undefined’, leaving the index in place
Delete
What is the most succinct way of finding the minimum number in an array?
Math.min.apply(null, arr)
Higher order functions allow us to abstract over [..], not just values
Actions
Second element in a regex/string match object
The first matched group
The shorter way to create a function binding is a function [..]
Declaration ( function square(x) { return x*x; } )
If an expression corresponds to a sentence fragment, then a [..] corresponds to a sentence.
Statement
Postfix operators return the value [..] operating
Before
Functions that automatically (when g or y modifiers are enabled) resets the lastIndex regex object property to 0 after a failure to match
test() and exec()
Bindings declared with ‘let’ and ‘const’ are local to the [..] that they are declared in.
Block
Array method that returns the index of the element matching the argument.
indexOf()
Syntax for rest parameters or spread operator
…
Function [..]s can be declared anywhere
Declaration
Methods usually act on the [..] they are a property of
Value
Bitwise not, which inverts all the bits in the operand and returns a number…
~
A function [..] is a regular binding where the value of the binding is a function.
Declaration
[..] are functions that live in properties
Methods
An [..] is a symbol/sign that maps [..] to output values
Operator
Operandi
If you try to destructure [..] or [..] you will get an error
Null
Undefined
Date object convention - day numbers start at
1
Delete does not work on any [..]
Non-configurable properties
Regex (or string) method that returns a match object
Exec
A fragment of code that produces a value is called an [..]
Expression
What is the Regexp string replacement method in JS?
replace
Every value in JS has a [..] that determines its role
Type
Delete works on functions which are part of an [..] (apart from the global scope)
Object
Unary operators cannot be [..]
Overridden
Most values have properties, but not [..] and [..]
Null
Undefined
If you omit a [..], the next line will be treated as part of the current statement.
Semi-colon
This operator converts to Boolean and then negates it
!
Timestamps are stored as the [..] since the start of 1970, UTC
Number of milliseconds
Using delete on an object’s property will…
… but it won’t delete it from the [..]
Remove it from the object (thence returning undefined when accessed)
Prototype chain
Method that returns a Boolean for a match on a regex
test
Functions that operate on other functions, by taking them as arguments or returning them, are called [..] function
Higher-order
Old-style variables, created using ‘var’, are [..] throughout the whole function they appear in (or else in the global scope).
Visible
Return value of unary + and - on functions and objects
NaN
Unary operator that yields a numeric expression
+
Function [..]s start with the function keyword.
Declaration
Arrays use [..] as the names of their properties
Numbers
There are some named properties of arrays, e.g. [..]
Length
First element in a regex/string match object
The whole matched string
This operator tries to convert the operand into a number and then negates it
-
Using a function as the second argument in a replace() method call, it will return..
A string
When a function produces a value, it’s said to [..] that value
Return
[..] means that the operator comes after the operand
Postfix
[..] operators are more efficient than standard JS function calls
Unary
A [..] is a piece of code wrapped in a value
Function
What key function in JS is ‘select’ in Ruby?
filter
When a regex/string group matches several times, [..] is returned in the match object
Only the first match
Function that converts an expression to JSON string
JSON.stringify
Global variable to reference the full match after a ‘replace’ call
$&
This method returns the index of the first regex match, or -1 if there wasn’t one
search
Function [..]s don’t require a semi-colon afterwards
Declarations
Regex object property that specifies the character position immediately following the last match
lastIndex
Using a function as the second argument in a replace() method call, [..] will be passed as arguments to that function
The matched groups (and the whole match)
JSON strings - [..] JavaScript, encoded so that it can be stored or sent
Serialized
Converted into a flat description
Date object convention - months start at
0
JSON stands for
JavaScript Object Notation
Unary operator that discards a return value of an expression
Void
Regex#test and Regex#exec will use this readable/writable property of the Regex object as a starting point for the match
lastIndex
Function that tests whether any element of an array matches a given predicate function
Some
Method on a date object that returns that number of milliseconds relative to 1970
getTime()
Function that finds the position (in an array) of the first element that matches a predicate
indexOf()
The collection of bindings and their values that exist at any given time is known as the [..]
Environment
A program is a list of
Statements
Function that parses a JSON string back into JS
JSON.parse
When a regex/string returns a match object, unmatched groups in the array will hold an [..] value
Undefined
In Regex, using this after a quantifier makes it lazy instead of greedy
?
Modifier for a regex to make it global
g
Prefix means that the operator comes [..] the operand
Before
All [..] in JSON strings have to be surrounded by double quotes.
Properties
A [..] operator is one that takes a single operand/argument and performs an operation.
Unary
[..] operators return the value after the operation
Prefix
A lazy quantifier consumes the [..] set of characters before returning a match
Smallest
Function that returns true when every element in an array returns true for a predicate function
Every