Intro to JavaScript Flashcards
What does it mean to declare a variable?
Tell the JavaScript engine that there exists a variable with a given name.
What does it mean to initialize a variable?
Tell the JavaScript engine that there exists a variable with a given name that will have an initial value defined by the code to the right of the assignment operator.
What does it mean to declare a function?
Tell the JavaScript engine what a function is named, what parameters can be passed in, what the function does then returns.
What types of data can be stored in a variable?
String, Number (Integers and Real/Decimal), Boolean (true/false), Objects, Functions
How is a date stored internally by the JavaScript engine?
As a real number (decimal) that represents the seconds since January 1, 1970. Left of the decimal represents whole seconds, and to the right of the decimal represents the fraction of the second.
What is a JavaScript engine?
The program that runs JavaScript in the browser
TRUE or FALSE: an array is an object?
TRUE. Arrays are special types of objects in JavaScript that have some special syntax. But normal object syntax applies as well. For example, you can declare an array with var array = []; or with var array = new Array();
What does null mean?
A value is explicitly not provided
What does undefined mean?
A value has not been defined
What is the difference between null and undefined?
null values do not exist, but are purposely set as not existing, while undefined values are simply unset to any value, including null.
What does NaN mean?
Not a NumberExamples would be 100/0 or sqrt(-1)
What “Truthy / Falsey”?
It is a way to evaluate conditions whereby a list of FALSE values is established and every other value is considered to be TRUE.
TRUE or FALSE: a variable can be changed from a string to a number in the middle of a program?
TRUE. Variables can be set using the assignment operator at any time in the program, and they can be set to any valid type with no limit on how many times the assignment can be performed.
What is the assignment operator?
=
What is the assignment operator in the context of a property of an object?
: