Pure JS Flashcards
A primitive data type that represents the absence of a value.
null
A primitive data type that is the value of a variable or object that has not been initialized, or of a function that returns no value.
undefined
A block of JavaScript code that you define once, and can invoke over and over again.
Function
A function defined in an object
Method
Name the all the Primitive Types
Numbers, Strings, Booleans, Null, and Undefined
Name the Object Types
Arrays, Functions, and Objects
Functions that are written to be used (with the new
operator) to initialize a newly created object.
Constructor
Any JavaScript type that can be changed, like objects and arrays.
Mutable Type
Any JavaScript type that cannot be changed, like numbers, strings, booleans, null
, undefined
.
Immutable Type
Variables declared inside a function have function scope and are visible only to code that appears inside that function.
Local Scope
A global primitive number that represents when something is not a number
NaN
Values that evaluate to boolean true or false but that aren’t actually boolean values of true or false.
Truthy or Falsey
Truthy Examples
Everything that is not “Falsey”
Falsey Examples
false, 0, “” (empty string), null, undefined, NaN
Boolean Comparison Operators
&&
(and), || (or), ! (not)
Globally defined symbols that are available to a JavaScript program like undefined, Infinity, NaN, isNaN(), parseInt(), eval(), Date(), RegExp(), String()
Global Object/Global Function
Literal
A data value that appears directly in a program
What is an Immediately-Invoked Function Expression?
(function(){ // …do something… })();
What is a Closure?
A function that returns another function. It makes it possible for a function to have “private” variables.
Function Declaration
function doSomething(){ // …do something… };
Function Expression
var doSomething = function(){ // …do something… };
Boolean
Something with the value of True or False
Statement
var statement = “I am a statement”; console.log(“I am also a statement!”); myFunction(); // I am a statement too; Statements are the instructions of a computer program – they are executed by the computer and perform some action or computation.
Fixed Values
Literals ex: Numbers, strings, expressions
Variable Values
Variables are used to store data values for a later time. Ex: var myVariable = “literal string”;
Reserved Words
words that have special meaning attached to them. There are dozens. a few examples are: break, for, if, null, etc…
Comments
// This is a one-line comment /* This is a multiple line (or block) comment */
camelCase
JS convention where you capitalize every new word besides the first. Ex: thisIsAnExampleOfCamelCase
Equality Operators
=== or !==
Comparison Operators
, >=, <=
Order of Operations
(), !, &&, ||; // in that order
Ternary Operator
variableToSet = (conditionToCheck) ? :