YDKJS Up and Going Flashcards
How do you quickly retrieve input in a browser popup?
const answer = prompt('Type answer');
What are objects?
Values that hold other values at specific named locations called properties.
A block is…
one or more statements wrapped inside a curly-brace pair {...}
An iteration is..
each time a loop block executes.
You can stop a loop with..
the break
statement
Each function gets its own..
scope
Lexical scope rules say that one scope can access variables of…
…either that scope or any scope outside (not inside) it
The built-in types are…
6 primitives:
string
number
boolean
null
undefined
-
symbol
(new in ES6)
and object
Use ____ to tell you the type of a value currently in variable
typeof variable
Variables can get to the undefined
state from…
- functions that have no return value
- the
void
operator
typeof
returns
-
function
type, a subtype ofobject
- implying it can have properties, although this won’t be used often
Object wrappers that pair with their primitive type and define method swhich go on its prototype are called…
natives.
string
value -> String
object
number
value -> Number
object
so on for all primitives that have properties and methods
When using a primitive value as an object by referencing a property or method…
JS automatically “boxes” the value in its object wrapper to enable the use of properties and methods.
All “falsy” values are:
""
-
0
,-0
,Nan
-
null
,undefined
false
Examples of “truthy” values are:
"hello"
42
true
-
[]
,[1, 2, 3]
-
{}
,{a: 42}
function foo() {...}