Chapter 3: Variables Flashcards
(47 cards)
JavaScript types can be divided into two categories: ______ types and ______ types
primitive, object
The special JavaScript values null and undefined are _______ values, but they are not
numbers, strings, or booleans
primitive
Any JavaScript value that is not a number, a string, a boolean, or null or undefined is
an _____
object
JavaScript defines another special kind of object, known as a ______
function
The most important thing about functions in JavaScript is that
they are true values and that JavaScript programs can treat them like _____
objects
Functions that are written to be used (with the new operator) to initialize a newly created
object are known as ______
constructors
Javascript types can be categorized as _____ and _____ types
mutable, immutable
In javascript, strings are immutable
True
JavaScript converts values liberally from one type to another. If a program expects a
string, for example, and you give it a number, it will automatically convert the number
to a string for you
True
When a number appears directly in a JavaScript program, it’s called a _____ _______
numeric literal
Javascript recognizes hexadecimal
True
All numbers in JavaScript are represented as floating-point
values.
True
JavaScript supports more complex
mathematical operations through a set of functions and constants defined as properties
of the ______ object:
Math
There are infinitely many real numbers, but only a finite number of them
(18437736874454810627, to be exact) can be represented exactly by the JavaScript
floating-point format. This means that when you’re working with real numbers in
JavaScript, the representation of the number will often be an ______ of the
actual number.
approximation
Core JavaScript includes a _____ constructor for creating objects that represent dates
and times.
Date()
var then = new Date(2010, 0, 1); // The 1st day of the 1st month of 2010
var later = new Date(2010, 0, 1, // Same day, at 5:10:30pm, local time
17, 10, 30);
In javascript a string is _____
immutable
To include a string literally in a JavaScript program, simply enclose the characters of
the string within a matched pair of ____ or _____
single, double quotes
____ is an escape sequence that represents a newline character
\n
One of the built-in features of JavaScript is the ability to _________ strings. If you use
the ____ operator with numbers, it adds them
concatenate, +
In addition to this
______ property, there are a number of methods you can invoke on
strings
length
s.length
Remember that strings are immutable in JavaScript. Methods like replace() and
toUpperCase() return new strings: they do not modify the string on which they are
invoked
TRUE
____ and _____ for boolean values
true, false
Boolean values have a _______ method that you can use to convert them to the strings
“true” or “false”
toString()
______ is a language keyword that evaluates to a special value that is usually used to
indicate the absence of a value.
null