JavaScript Fundamentals Flashcards

Mod 2

1
Q

Data Type

A

A type of data, e.g., String, Boolean, Number, Object, Array, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Primitives / Simple Data Types

A

Basic data types like String, Boolean, Number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Complex Data Types

A

Data types that are not Primitives, e.g., Objects, Arrays

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Object

A

A data structure of key value pairs that groups related data and behavior

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Key

A

The name used to refer to a Value in an Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Value

A

The value referenced by a Key in an Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Array

A

List-like objects, used for storing a list of related values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Function

A

A grouping of executable code. Objects that contain JS code which can be repeatedly invoked/executed. Can be manipulated just like any other Object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Method

A

A function that’s defined as a property of an object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Scope / Context

A

Where variables and functions are accessible

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Parameters

A

The variables a function says it will take in when it runs. Declared inside (parens)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Arguments

A

The actual variables a function uses when it runs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Prototype

A

An object that allows a one object to inherit methods and properties from another

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Primitive (Primitive value, Primitive data type)

A

Data that is not an object and has no methods. There are 7 primitive data types: string, number, bigint, boolean, null, undefined, and symbol. All primitives are immutable, i.e., they cannot be altered.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

JavaScript Engine/Interpreter

A

A program that executes JavaScript code. Most commonly used in web browsers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Hoisting

A

The process of implicitly moving the declaration of variables and functions to the top of their scope

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Creation Phase

A

The phase where the interpreter sets aside some space in memory to store any variables and functions we might need access to.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Execution Phase

A

The phase where the interpreter executes Javascript code, line-by-line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Execution Call Stack

A

A tool (data structure) for the interpreter to keep track of its place in a script that calls multiple functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

TDD

A

Test Driven Development / Design

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Assertion

A

An expression containing some testable logic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Assertion Library

A

A package of assertion functionality. Usually distinct from a Testing Framework.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Testing Framework

A

A library that determines how tests are organized and executed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Red Green Refactor

A

The process of writing a failing test, making it pass, then refactoring the tests and/or implementation with confidence

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Test Phases
A test that is organized into the phases [Setup, Execution, Assertion, Teardown*]
26
Object-oriented programming (OOP)
An approach that structures your code around objects rather than functions and procedures, real-world objects are each viewed as separate entities having their own state which is modified only by built-in procedures, called methods
27
Programming paradigm
A style or way of thinking about and approaching programming problems
28
Constructor Function
The function called to create a new instance of an object. Usually contains the code to set up the object.
29
Class
A blueprint or template of an object that describes what information it should contain and how it should interact with the data
30
Instance
One specific copy of an object
31
Encapsulation
Hiding the details of how an object works by grouping data and behavior
32
SRP Single Responsibility Principle
a class should only have one responsibility, ‘one reason to change’
33
Coupling
The level of connectedness between two objects
34
this
Keyword that references the current context (or owner) of the code being executed or the object on which the current function is called; context is usually determined by how a function is invoked
35
How are constructor functions and classes invoked?
With the new operator
36
Prototype methods
Functions that allow you to manipulate the value of a particular data type or class
37
Array.forEach(callbackFunction)
Use Case: when you want to perform an operation on every element in an array. Note: _ does NOT return anything. It’s just a for loop in a method.
38
Array.map(callbackFunction)
Use Case: when you want a new array based on your original, with some modification to each item. Note: _ will return a new array of the same length as the original array.
39
Array.find(callbackFunction)
Use case: when you need to find a particular item in an array that matches a given condition. It will return the very first array element where the callback function returns true, even if there are multiple matches. Note: the callback needs to return a boolean. You also cannot modify the element you’re finding
40
Array.filter(callbackFunction)
Use case: it will return a new array with all elements that match. Note: the callback needs to return a boolean. You also cannot modify the element you’re finding
41
Array.reduce(callbackFunction, initialValue)
Use Case: If you need to turn an array into a single value. This single value could be a number, string, object, or another array. To accomplish this, _ takes in two parameters: callback function and initial value
42
Callback Function
Within the _, we have access to the accumulator, the current element in the iteration, the current element’s index, and the original array we are looping over
43
Initial Value
The _ _ to be used as the accumulator (the first argument to the first call of the callback). The accumulator is the ‘single value’ that will eventually be returned.
44
accumulator
The ‘single value’ that will eventually be returned. It’s called an _ because each iteration over the array will modify the accumulator value until the loop is complete.
45
Package Manager
A registry where developers can publish small, reusable pieces of code that they’ve written and would like others to be able to incorporate into their projects
46
Package
Small, independent piece of reusable code that often solves a commonplace problem
47
Dependency
A package that your project relies on in order to function properly
48
Configuration File
A file that allows you to define how a particular tool you’re using should interact with your codebase
49
.eslintrc
Defines our rules for stylistic conventions we want our code to follow
50
.gitignore
Tells git not to push certain files to our remote repo
51
README.md
Allows us to describe our application and provide any instructions to people trying to use or contribute to it
52
package-lock.json
Builds a dependency tree of any third-party code we are relying on and what versions of those packages our app is using
53
package.json
Describes our application to NPM and what dependencies we need in order to use and develop the app
54
Configuration file
A file that allows you to define how a particular tool you’re using should interact with your codebase (ex: .eslintrc, .gitignore, .package.json, .package-lock.json)
55
NPM Files
Node Package Manager files are .package.json and .package-lock.json
56
Dependency
When we incorporate an NPM package into our codebase
57
devDependencies
Packages needed only for you, the developer, to efficiently and effectively work on your application (ex: eslint, mocha and chai)
58
dependencies
Packages that are required for a user to actually view and interact with your application (ex: jQuery)
59
node-modules
Directory where our application looks for all of the packages our project relies on, included in .gitignore files - we do not commit this to GitHub
60
Scope
The level in which a variable can be accessed
61
Global scope
Default, everyone and everything has access to it; functions and variables are "vulnerable" because they can be accessed by everything and potentially mutated (changed); can use var, let, or const
62
Function scope
Variables declared in the function (using var, let, or const) can only be accessed by other code inside the function; you control what's in this scope (cannot be meddled with by anyone or anything else); the global scope cannot access this scope
63
Block scope
Variables declared in the block statement (if blocks, for loops, etc) using let or const can only be accessed by other code inside the block; Variables declared using var will not be scoped within the block, var will "leak out"
64
Scope chain
Used to resolve the value of variable names in JavaScript; essentially a stack of currently accessible scopes, from the most immediate context to the global context
65
prototype
A special object which is assigned to functions that you make in JavaScript
66
[[prototype]]
A hidden link on every object that links objects to one another, allowing objects to share behaviors
67
__proto__, aka “dunder-proto” (double-underscore proto)
A property that exposes the internal [[prototype]] property. This [[prototype]] property acts a as a reference that points to a function’s prototype object. It is this reference, or linking, between objects that makes up the prototype chain.
68
Prototype chain
Allows us to define behavior in one place (or one prototype object) and share it between many objects
69
Invoke / Execute
To run a function. e.g., “I’ve invoked the function here”
70
Declare
To write a function definition. Usually distinct from function execution.
71
a _ is when an inner function has access to its outer function’s variables
closure
72
lexical scope aka static scope
our scope is statically bound, and therefore perfectly predictable upon authoring our code
73
the eventual result of an asynchronous operation
Promise
74
A library built to get around the pain points of early Javascript
jQuery
75
A group of servers spread out over many locations to store duplicate copies of data so that servers can fulfill data requests based on which servers are closest to the respective end-users
Content Delivery Network (CDN)
76
A file that the browser can still interpret correctly, but has none of the bits helpful to humans. Used to reduce the size of a file.
Minified
77
A phase of development where source code is converted into some other final format
Build Process
78
A computer or program that handles the sending and retrieving of resources
Server
79
A class that inherits from a parent class (also known as a child class)
Subclass
80
The practice of allowing new objects to take on the data and behavior of their parents
Inheritance