What is Programming?
telling the computer to manipulate data
What is a Variable?
named location for storing a value
What are Comments?
section of code that the computer ignores
i.e. for humans to read
//
/* comment */
What are Functions?
prime mechanism with which to manipulate data and usually returns a value
Functions are one of the fundamental building blocks in JS
A function is a JavaScript procedure, which is:
A set of statements that perform a task or calculate a value
A function definition (or declaration) consists of a function keyword, followed by:
The name of the function
A list of parameters to the function, enclosed in parentheses and separated by commas
The JS statements that define the function, enclosed in curly braces { }
What is Undefined?
Data type in Javascript
variable is not assigned to a particular value
what are Booleans?
logical value type
can be true or false
What are Numbers?
only one number type in JS,
positive, negative, integer, floating point (decimal)
+Infinity ; -Infinity ; NaN
What are some primary JS Operations / Operators?
\+ ; - ; * ; / % Modulus (division remainder) \++ Increment -- Decrement = \+= ; -= ; *= ; /= ; %= ; example x += y is x = x + y
Explain Function vs Arguments
function addTwo(num) {
return num + 2;
}
function "takes" as its parameter is num; actual "call" to the function is addTwo(6) 6 is the "argument"
What is a String?
primitive and scalar data type stores a series of characters "string is between quotes" double or single quotes index starts at 0
What are the Primitive Data Types?
There are 6 primitive data types:
What are the Collection Data Types?
arrays
objects
What is an Array?
The array is used to store an ordered list of multiple values in a single variable
Arrays are considered “objects” in JS
What is an Object?
An object is a collection of properties
A property is an association between a name (key) and a value (some data type)
A property’s value can be any of the types we have gone over, as well as being another object, or even a function
In the case where the value of a property is a function, we refer to the property as a method
What is typeof operator?
One very useful tool in programming is the typeof operator
Its functionality is rather simple, and when applied to a value, it will tell you the type of value in question
What is an Array.isArray?
a method to determine if a type is an array or an object
What is an Operator?
An operator is used to perform specific computations or operations on operands
We have seen a few so far: =,+, -, and typeof
They can be unary: {operator} {operand} (e.g. typeof “username”), or:
They can be binary: {operand1} {operator} {operand2} (e.g. 4 + 5)
There are many more
What is a Method?
A method is a function that is a property of an object
We have seen a few so far: console.log, and Array.isArray()
There are many more
What are the falsy values?