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
Q

Test Phases

A

A test that is organized into the phases [Setup, Execution, Assertion, Teardown*]

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

Object-oriented programming (OOP)

A

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

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

Programming paradigm

A

A style or way of thinking about and approaching programming problems

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

Constructor Function

A

The function called to create a new instance of an object. Usually contains the code to set up the object.

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

Class

A

A blueprint or template of an object that describes what information it should contain and how it should interact with the data

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

Instance

A

One specific copy of an object

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

Encapsulation

A

Hiding the details of how an object works by grouping data and behavior

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

SRP Single Responsibility Principle

A

a class should only have one responsibility, ‘one reason to change’

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

Coupling

A

The level of connectedness between two objects

34
Q

this

A

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
Q

How are constructor functions and classes invoked?

A

With the new operator

36
Q

Prototype methods

A

Functions that allow you to manipulate the value of a particular data type or class

37
Q

Array.forEach(callbackFunction)

A

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
Q

Array.map(callbackFunction)

A

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
Q

Array.find(callbackFunction)

A

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
Q

Array.filter(callbackFunction)

A

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
Q

Array.reduce(callbackFunction, initialValue)

A

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
Q

Callback Function

A

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
Q

Initial Value

A

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
Q

accumulator

A

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
Q

Package Manager

A

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
Q

Package

A

Small, independent piece of reusable code that often solves a commonplace problem

47
Q

Dependency

A

A package that your project relies on in order to function properly

48
Q

Configuration File

A

A file that allows you to define how a particular tool you’re using should interact with your codebase

49
Q

.eslintrc

A

Defines our rules for stylistic conventions we want our code to follow

50
Q

.gitignore

A

Tells git not to push certain files to our remote repo

51
Q

README.md

A

Allows us to describe our application and provide any instructions to people trying to use or contribute to it

52
Q

package-lock.json

A

Builds a dependency tree of any third-party code we are relying on and what versions of those packages our app is using

53
Q

package.json

A

Describes our application to NPM and what dependencies we need in order to use and develop the app

54
Q

Configuration file

A

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
Q

NPM Files

A

Node Package Manager files are .package.json and .package-lock.json

56
Q

Dependency

A

When we incorporate an NPM package into our codebase

57
Q

devDependencies

A

Packages needed only for you, the developer, to efficiently and effectively work on your application (ex: eslint, mocha and chai)

58
Q

dependencies

A

Packages that are required for a user to actually view and interact with your application (ex: jQuery)

59
Q

node-modules

A

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
Q

Scope

A

The level in which a variable can be accessed

61
Q

Global scope

A

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
Q

Function scope

A

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
Q

Block scope

A

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
Q

Scope chain

A

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
Q

prototype

A

A special object which is assigned to functions that you make in JavaScript

66
Q

[[prototype]]

A

A hidden link on every object that links objects to one another, allowing objects to share behaviors

67
Q

__proto__, aka “dunder-proto” (double-underscore proto)

A

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
Q

Prototype chain

A

Allows us to define behavior in one place (or one prototype object) and share it between many objects

69
Q

Invoke / Execute

A

To run a function. e.g., “I’ve invoked the function here”

70
Q

Declare

A

To write a function definition. Usually distinct from function execution.

71
Q

a _ is when an inner function has access to its outer function’s variables

A

closure

72
Q

lexical scope aka static scope

A

our scope is statically bound, and therefore perfectly predictable upon authoring our code

73
Q

the eventual result of an asynchronous operation

A

Promise

74
Q

A library built to get around the pain points of early Javascript

A

jQuery

75
Q

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

A

Content Delivery Network (CDN)

76
Q

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.

A

Minified

77
Q

A phase of development where source code is converted into some other final format

A

Build Process

78
Q

A computer or program that handles the sending and retrieving of resources

A

Server

79
Q

A class that inherits from a parent class (also known as a child class)

A

Subclass

80
Q

The practice of allowing new objects to take on the data and behavior of their parents

A

Inheritance