Web Development Deck Flashcards

1
Q

Where do you put non-visible content about the HTML document?

A

Place the information in the HEAD element of the HTML document. This element can contain things such as TITLE or other metadata that can help your website be identified better by search engines.

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

Where do you put visible content about in the HTML document

A

Place it in the BODY element. This can include all of your written content such as text, images, links, etc. Examples of elements in the BODY include: h1, h2, p, span, div, etc.

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

Where do the HEAD and BODY tag go in a valid HTML document?

A

They go within the HTML element. HEAD will go above the BODY element.

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

What is the purpose of the < !DOCTYPE > declaration?

A

The purpose is to identify which version of HTML the page is using. It also helps a page render correctly. (Especially useful if using the box model)

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

Give five examples of HTML element types.

A

Examples of HTML elements include:
1. h1-h6 for creating headings of your content (h1 is the largest)
2. < p > for creating paragraphs in your webpage
3. < div > for creating divisions or sections
4. < img > for creating images
5. < ol > for creating ordered lists

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

What is the purpose of HTML attributes?

A

Provide extra information about a specific element → examples could be the language of a browser, an ID, or class

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

What is an example of an HTML entity (escape character)?

A

Escape characters are those that are used either to represent characters reserved for HTML (like the <, >, “, &) or for symbols such as copyright and trademark.

Examples:
1. < <
2. > >
3. & &

Need to check browsers to make sure it renders correctly though.

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

How do block-level elements affect the document flow?

A

They create a new line on the browser window that will take up the entire space of their parent element.

Examples will include: < div >, < h1 >, < /h1 >< p >< /p >< /div >

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

How do inline elements affect the document flow?

A

They appear on the same line as their neighboring elements. These can include elements that you want to create a semantic feel to your page.

Examples include: < em >, < strong >, < span >

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

What are the default width and height of a block-level element?

A

Because block elements create a new line on the browser window, they will take up the entire horizontal space of their parent container (the containing block). Their height will only take up what is necessary.

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

What are the default width and height of an inline element?

A

They will only take as much width and height as necessary –> as determined by the size of its content. It is bounded to the same dimensions as the tags they are residing in.

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

What is the difference between an ordered list and an unordered list in HTML?

A

Ordered lists <ol>: each item in a list is numbered → could use it for steps of a recipe; legal contract; something that needs to be defined by a number essentially

Unordered list </ol><ul> → begin with a bullet point. Does not indicate an order of anything [ingredient list]</ul>

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

Is an HTML list a block element or an inline element?

A

A list is a block element. It will create a new line for each of its list items & push everything else down the list.

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

What HTML tag is used to link to another website?

A

< a > Tag with the href attribute’s value being the page that you want people to go to when they click on your specific link.

If linking to another website, you would use the absolute URL.

< /a >

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

What is an absolute URL?

A

It is the full web address that you want someone to go to when they click on the link. For example, it starts with the domain name and can be followed to a specific page.

Could take you to a completely different website.

Example: google.com

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

What is a relative URL?

A

Links to pages within the SAME site. It is a shorthand version of a URL because you don’t need the domain name.

Instead, you just need the shorter name of it (most likely it will just be the name of the file instead; if it’s in the same folder). If it’s not in the same folder then it might be a little more complex.

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

How do you indicate the relative link to a parent directory?

A

You use ../ to indicate folder above the current one, then you follow it with the file name.

Example:
../index.html (home)

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

How do you indicate the relative link to a child directory?

A

Use the name of the child folder(directory), then a forward slash, then the file name

Example:
music/listings.html (page)

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

How do you indicate the relative link to a grand parent directory?

A

Repeat the ../ to indicate that you want to go UP two folders (instead of just one), then follow with the file name

Example:

../../index.html (returns user to homepage)

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

How do indicate the relative link to the same directory?

A

Just use the file name. You don’t need to include anything else since it is within the same folder/directory.

Example:

reviews.html

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

What is the purpose of an HTML form element?

A

It is where all of the form controls are located. - It’s where interactive controls for submitting the information is located.

Place to collect information from your user.

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

Give three examples of type attribute values for HTML form elements.

A

type=”text” → this is used for inserting text into a field.

type=”password” → similar to “text” but the characters are blocked out and hidden so someone cannot see it.

type=”radio” → clicking just one option (note → radio buttons cannot be deselected → use checkbox if you want them to deselect something)

type=”file” → upload a file

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

Is an HTML < input > element a block element or an inline element?

A

Input element is an inline-block element. Elements will line up next to each other. But! You can also set the height of the option.
→ So you need to make it a block element or add something like a div element to make it go onto a different line if you’d like for your options to stack

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

Give five examples of form control elements.

A

input: creates different types of form controls such as input: type = ”text”
textarea: creates multi-line elements
select: drop-down list
option: option of a drop-down list
fieldset: group elements together
button: create a button

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

What are the six primary HTML elements for creating tables?

A

table: Creates the table
tr: Creates the start of each row
td: Creates data elements into the row
th: Creates the heading for either a column or row
thead: Creates the heading of the table (headings should sit inside this element)
tbody: body elements (data contents should reside here)
tfoot: (not common) element for the footer of a table

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

What purpose do the thead and tbody elements serve?

A

These are semantic elements that make it easier for screen readers & accessibility purposes.

thead is good for placing the headings of your tables
tbody is good for identifying the content of your headings

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

Give two examples of data that would lend itself well to being displayed in a table

A

A financial result –> needing to identify the amount of money in your account or spending for a specific month

Sport results –> looking at the stats of different teams or players

Schedules

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

What are the names of the individual pieces of a CSS rule?

A

Selector → which element the rule applies to
Declaration Block: indicates how the element should be styled {⇒ split into two parts
Property → indicate aspects of the element you want to change
Value → indicates the setting you want to use for the property

Ends with the curly brace of the }

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

In CSS, how do you select elements by their class attribute?

A

Use a period (full stop) symbol followed by the value of the class attribute.

Example:

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

In CSS, how do you select elements by their tag name?

A

Use just their name of the element: example → p, h1, h2

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

In CSS, how do you select an element by its id attribute?

A

To match with an ID attribute, you need to use the pound or hash symbol → # & match that with the value of the ID attribute.

Example:

<p>
#entry{
}</p>

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

Name three different types of values you can use to specify colors in CSS.

A

RGB Values: colors in terms of how much red, green, and blue are used to make them

HEX Codes: 6-digit codes that represent the amount of red, green, and blue in a color; preceded by hash #

Color Names: 147 predefined color names recognized by browser.

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

What CSS properties make up the box model?

A

Content –> What’s written inside.

Padding → space between border of a box and any content contained within it. Adding padding can make text more legible

Border → separates the edge of one box from another box

Margin → sits outside the edge of the border → width can create gaps between borders of adjacent boxes

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

Which CSS property pushes boxes away from each other?

A

Margin → push boxes away from each other. This can create more gaps between different elements/boxes. It would allow your reader to have more whitespace to be easier to read.

It will push boxes away if it is a

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

Which CSS property adds space between a box’s content and its border?

A

Padding will add the space between a box’s contents & its borders. Adding padding is a great way to make your content more legible.

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

What is a pseudo-class?

A

A keyword added to a selector to specify a special state of the element that was selected. An example could be: :hover (change a color of something when the cursor hovers over it)

Another example could be: nth-child(#);

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

What are CSS pseudo-classes useful for?

A

It lets you apply the style to an element in response to external factors, changes in the status of content, or the position of the mouse.

Could be useful for user-feedback –> add active styles | can give visual feedback that something can’t be clicked or clicked

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

Name two types of units that can be used to adjust font-size in CSS

A

Rem → recommended to use at will make things proportional in your texts.

PX → this often the best way to make sure tha tit will appear as the intended size that you want

Percentages → This is the % of the default size of the element (web browser is 16%) | drawback can be if people adjusted the default size of their browser, this will alter size of the text)

Ems → This is used in relation to

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

What CSS property controls the font used for the text inside an element?

A

font-family
(You will typically want to include several values for font-family → you will want to include several different versions of it (with the generic name at the end in case browser cannot load font)

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

What is the default flex direction of a flex container?

A

The default direction is row (will appear in a horizontal row automatically)

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

What is the default flex wrap of a flex container?

A

Default flex-wrap is “no wrap” so, the items will not wrap

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

Why do two div elements “vertically stack” on one another by default?

A

Because they are block elements by default, so they will take up the entire width of their parent container.

This is why you need to set up flex wrap of the container to wrap so that the elements can wrap around each other.

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

What is the default flex-direction of an element with display: flex?

A

The default flex-direction is row → you can adjust it with column, row-reverse or column-reverse.

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

What is the default value for the position property of HTML elements?

A

position: static

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

How does setting position: relative on an element affect document flow?

A

It does not affect the rest of the document flow. The way elements appear is different though.

It only allows you to use different box-offset properties & manipulate where something appears

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

How does setting position: absolute on an element affect document flow?

A

It takes that specified element out of the document flow, so the other elements are no longer affected by it on the page.

The other elements pretend it is no longer there and fills the gap that’s left behind.

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

How does setting position: absolute on an element affect where it appears on the page?

A

It takes it out of the page so you can move the element around it may appear to overlap other elements on the page

  • It appears relative to its nearest non-static ancestor

Box offset properties can be used to specify where it appears on the screen

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

How do you constrain an absolutely positioned element to a containing block?

A

You look for the parent container and set that to “position: relative” –> absolutely positioned element will appear relative to non-static ancestor

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

What are the four box offset properties?

A

Distances from:
- Top
- Left
- Bottom
- Right

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

What is the purpose of variables?

A

It stores data → allows you to call the data throughout a specific script/program.
So you can manipulate it, bring it back when you need to call it

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

How do you declare a variable?

A

You need to use a variable keywork like “var, let, const” and then give your variable a name and then you can give it a value if you want

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

How do you initialize (assign a value to) a variable?

A

To assign a value to a variable yo use the variable name with an assignment operator (=) and the value you want to give it

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

What characters are allowed in variable names?

A

It must begin with a letter, $, _ → cannot start with a number

It can contain letters, dollarsigns, or underscores

Just can’t use reserved words/letters (like var)
Use camelcase for multiple words

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

What does it mean to say that variable names are “case sensitive”

A

Means that your variables have to match if you use it throughout your program
So…. “score” and “Score” are different variables

Need to be consistent

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

What is the purpose of a string?

A

Allows you to have text content or things that need to be stored with letters/characters

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

What is the purpose of a number?

A

It can be useful for calculations → mathematical operations

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

What is the purpose of a boolean?

A

Can help determine which part of a script should be run → purpose is for decision making
Allows us to make branches/paths in our code

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

What does the = operator mean in Javascript?

A

Assignment operator → set of data is assigned to something

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

How do you update the value of a variable?

A

Use the variable’s name → and give it a new value. Don’t use “var” keyword

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

What is the difference between null and undefined?

A

Null → intentiionally is a nonexistent or invalid object
→ null is a placeholder (temporary absence of something, don’t know the value of it yet) → has to be assigned to something | when you see null (someone said this is empty on purpose, maybe needs a value later, but now it’s empty)

Undefined → nothing being assigned, no one has even given it a placeholder. Just empty.

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

Why is it a good habit to include “labels” when you log values to the browser console?

A

Organization purposes → reminders/description of what you’re doing. Without labels it’s difficult to understand what is happening

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

Give five examples of Javascript primitives.

A

Number
String
Boolean
Null
Undefined

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

What data type is returned by an arithmetic operation?

A

A number (performs basic math)

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

What is string concatentation?

A

When you combine different string values using the string and a + sign

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

What purpose(s) does + plus operator service in JavaScript?

A

It can be used for addition
It can be used to combine & join strings together

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

What data type is returned by comparing two values (<, >, ===, etc.)?

A

A boolean expression (true, false)

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

What does the += “plus-equals” operator do?

A

adds the value of the right operand to a variable and assigns the result to the variable

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

What are objects used for?

A

Useful for storing lots of different variables and details into something.

used to group items together.

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

What are object properties?

A

They are variables that are part of an object

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

Describe object literal notation.

A

You include:
Var objectName (whatever you want to name it) {
key: value (this makes up a property),
};

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

How do you remove a property from an object?

A

Use the delete operator

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

What are the two ways to get or update the value of a property?

A

You can use dot notation (name of the object . property) or you can use square brackets:
objectName[‘property’] = property value

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

What are arrays used for?

A

It can store a list of values that you want (esepcially if you don’t know how many items will be in a specific list)

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

Describe array literal notation.

A

You use the:
Var arrayName = [ value, value, value];

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

How are arrays different from “plain” objects?

A

The key for reach value of an array is an index number instead of a property name

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

What number represents the first index of an array?

A

0

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

What is the length property of an array?

A

It tells you the number of arrays that it holds

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

How do you calculate the last index of an array?

A

You use the length of the array - 1

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

What is a function in JavaScript?

A

Functions allow you to package up code for use later in your program.

They can be a list of steps that you can call over and over.

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

Describe the parts of a function definition.

A

The function keyword to begin the creation of a new function.
An optional name.
A comma-separated list of zero or more parameters, surrounded by () parentheses.
The start of the function’s code block, as indicated by an { opening curly brace.
An optional return statement.
The end of the function’s code block, as indicated by a } closing curly brace.

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

Describe the parts of a function call

A
  1. The function’s name.
  2. A comma-separated list of zero or more arguments surrounded by () parentheses.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
82
Q

When comparing them side-by-side, what are differences between a function call and a function definition?

A

When you are calling a function you are using the function name and passing arguments

When you are defining a function you are using the word “function” and declaring parameters as placeholders for values that would be in your function. Would also have a code-block { }

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

What is the difference between a parameter and an argument?

A

Parameter is a placeholder that you are using when you are defining a function.

An argument is a value that you are passing when you are calling a function. They are the actual values that are provided when you’re using them

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

Why are function parameters useful?

A

They are useful because they act as a placeholder for a value that is unknown until you call the function

Allows us to create variants in our code –> create a single tool that can be used in multiple places

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

What two effects does a return statement have on the behavior of a function?

A

1 - Causes the function to produce a value we can use in our program. (results can be used outside the function)

2- Prevents any more code in the function’s code block from being run. (stops the function)

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

Why do we log things to the console?

A

Use: console.log in your program to check the outputs of things so that you can see if your code is working the way you want it to

Can be a debugging tool if necessary

Gives you a way to see something in an easily visible space

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

What is a method?

A

It’s a function that is a property of an object → it is essentially a built-in task that can be performed by an option or a task that is called on an object → function stored into the property of an object

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

How is a method different from any other function?

A

Have to provide context of what object you are pulling it off of
Stored into an object (HAVE to state the object you are using the method from)

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

How do you remove the last element from an array?

A

Use the pop() method

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

How do you round a number down to the nearest integer?

A

Use the “Math.floor()” method of your number or value
ALWAYS rounds down

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

How do you generate a random number?

A

Use Math.random();
Prints a number between 0 and 1
Represents a percentage

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

How do you delete an element from an array?

A

Use the splice() method
You can use splice and then state which index you wish to remove and how many elements you want to remove from the starting point

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

How do you append an element to an array?

Append → adds to the end

A

Use the push ( ) method, which will allow you to add one or more elements to an array

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

How do you break a string up into an array?

A

Use the split ( ) method of an array
Inside → dictate what you want to split out of the array

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

Do string methods change the original string? How would you check if you weren’t sure?

A

No, they pass them into a new array that they create
You can check by using a console.log statement and passing the variable with the string to see if it changed

Can also look at documentation

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

Roughly how many string methods are there according to the MDN Web Docs?

A

Over 50 different string methods?

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

Is the return value of a function or method useful in every situation?

A

Should always have an application. It’s useful, but it might not always be necessary to include in something

If a function does not have a return value, the console log will say “undefined” after the function is run

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

Roughly how many array methods are there according to the MDN Web docs?

A

Over 50?

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

What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?

A

MDN

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

Give 6 examples of comparison operators.

A

<,
>,
==,
<=,
>=,
=== (strictly equal),
!=,
!== (strictly not equal to)

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

What data type do comparison expressions evaluate to?

A

Boolean (true or false)

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

What is the purpose of an if statement

A

Allows you to run a conditional statement so that your program can make decisions based on whether a condition has been met.

Can allow us to do branching actions

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

Is else required in order to use an if statement

A

No –> You can have an “if” statement on its own, you could just have an “if” and not do anything afterward

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

Describe the syntax (structure) of an if statement.

A
  1. if keyword
  2. Need a condition statement in ( )
  3. Opening curly brace
  4. Code to execute if the value is true
  5. Closing curly brace
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
105
Q

What are the three logical operators?

A

&& (logical and)
| | (logical or)
! (logical not – boolean inverse)

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

How do you compare two different expressions in the same condition?

A

You use logical operators to make the comparisons of the different expressions (logical AND or logical OR)

You also need to use parentheses between each expression

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

What is the purpose of a loop?

A

Allows you to repeat code as many times as you want.

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

What is the purpose of a condition expression in a loop?

A

It’s the break to the loop → decides if they loop should stop or keep going

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

What does “iteration” mean in the context of loops?

A

Each pass / cycle through a loop

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

When does the condition expression of a while loop get evaluated?

A

Before each pass through a different loop (if the expression is true, the statement in the loop is executed, if it is false, it will not execute the statement in the loop

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

When does the initialization expression of a for loop get evaluated

A

It gets evaluated once before the loop begins (typically it is a counter variable)

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

When does the condition expression of a for loop get evaluated?

A

It gets evaluated before each loop iteration (if the loop evaluates to true, the statement is executed, if false, the execution exits the loop & goes to first statement after “for”)

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

When does the final expression of a for loop get evaluated?

A

End of each loop iteration (before the next evaluation of condition)

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

Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?

A

break

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

What does the ++ increment operator do?

A

It adds one to the counter (so it increments the loop)

Drives the loop toward termination
Get closer to reaching it as false
Driving the loop TOWARD termination/false

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

How do you iterate through the keys of an object?

A

You use a “for…in…” loop.

The loop inside the “for..in” loop is iterated through each property once

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

What are the four components of “the Cascade”

A

Source Order → order that CSS rules are written in your stylesheet/ Last element provided is the ultimate item taken affect

Inheritance → properties on a child HTML element receive a value from a parent element. If no CSS declared on the child

Specificity → decides how a browser decides which CSS property to apply to an element

!Important

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

What does the term “source order” mean with respect to CSS?

A

The order that CSS rules are written in your stylesheet/ Last element provided is the ultimate item taken affect

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

How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?

A

Inheritance makes it possible
Inherited properties = default set from parent element (children will get this computed value)
Non-inherited properties → properties set at the initial value of the property

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

List the three selector types in order of increasing specificity.

A

Type - Class - ID

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

Why is using !important considered bad practice?

A

Because it overrides specificity; Use cascade layers & lower weight specificity throughout CSS so styles can be easily overridden with more specific rules

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

What does the transform property do?

A

It allows you to rotate, scale, skew, or translate an element across the coordinate planes

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

Give four examples of CSS transform functions.

A

rotate();
translateY();
scale();
skew();

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

The transition property is shorthand for which four CSS properties?

A

transition-property,
transition-duration,
transition-timing-function,
and transition-delay.

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

Why do we log things to the console?

A

Use: console.log in your program to check the outputs of things so that you can see if your code is working the way you want it to

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

What is a “model”?

A

A diagram that represents something

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

Which “document” is being referred to in the phrase Document Object Model?

A

It is a copy of the web page you are on (HTML element)

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

What is the word “object” referring to in the phrase Document Object Model?

A

JavaScript objects → JavaScript object modeling the HTML document.

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

What is a DOM tree?

A

An element plus ALL of its content and ALL of its configurations

Could be an entire web page or just one element.

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

Give two examples of document methods that retrieve a single element from the DOM.

A

getElementById( )

querySelector( ) –> querySelector is all you really need to use.

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

Give one example of a document method that retrieves multiple elements from the DOM at once

A

querrySelectorAll( ) –> only one really needed.

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

Why might you want to assign the return value of a DOM query to a variable?

A

Because you want to store the location of the element within the DOM tree → if you use it more than once it saves the browser time looking for the element.

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

What console method allows you to inspect the properties of a DOM element object?

A

Console.dir() → allows you to see the different properties

(short for directory)

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

Why would a script tag need to be placed at the bottom of the HTML content instead of at the top?

A

B/c the browser loads the HTML document first.

Gives time for your HTML to load

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

What does document.querySelector() take as its argument and what does it return?

A

It takes a string that has one or more selectors it needs to match (needs to be a valid CSS string)

Returns FIRST element with the document that matches the specified selector or group of selectors → if no match found then NULL

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

What does document.querySelectorAll() take as its argument and what does it return?

A

It takes a string that has one or more selectors it needs to match (needs to be a valid CSS string)

Returns a non-live Node list that has one element object for each element that matches the specified selector

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

Why do we log things to the console?

A

Use: console.log in your program to check the outputs of things so that you can see if your code is working the way you want it to

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

What is the purpose of events and event handling?

A

Events provide interactivity for your users, they can trigger code that you are going to use, and they can have code that responds to users. Sometimes it can be not user driven (like time or page loading)

Event handling determines how users interact

Event handling includes;
Selecting the node that you want script to respond
Indicating events on nodes that you want to trigger responses
State the code you want run once an event occurs

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

Are all possible parameters required to use a JavaScript method or function?

A

No –> often there are optional parameters

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

What method of element objects lets you set up a function to be called when a specific type of event occurs?

A

addEventListener(……..); Call it on whatever element you want to add it for and listen for a specific event.

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

What is a callback function?

A

Function that is passed into another function as an argument, which is invoked inside the outer function.

Expected result = expected function being called will be called, too.

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

What object is passed into an event listener callback when the event fires?

A

The event object & contains all the data about that object when the event occurs –>

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

What is the event.target? If you weren’t sure, how would you check? Where could you get more information about it?

A

The actual element where the event occurred (not the element itself). Where you interacted where the event occurred.

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

What is the difference between these two snippets of code?

element.addEventListener(‘click’, handleClick)

element.addEventListener(‘click’, handleClick())

A

Without the parenthesis it represents that the function runs when the event fires –> it is a callback function

With the parentheses () it means that the code is run was the page loads –> It is a return value that will be in its place

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

What is the className property of element objects?

A

It gets and sets the value of the class attribute of the DOM specified element

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

How do you update the CSS class attribute of an element using JavaScript?

A

You use the element you want to use.

And then use the .className property

and THEN you assign that to a string variable that represents the class you want (or multiple classes with space separators)

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

What is the textContent property of element objects?

A

It allows you to collect or update text that is in the containing element

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

How do you update the text within an element using JavaScript?

A
  1. Whatever the DOM location query is from ( a variable)
  2. .
  3. You use the textContent property on the containing element.
  4. Whatever string or value you want it to be.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
149
Q

Is the event parameter of an event listener callback always useful?

A

No, it is not necessary [odds of an event listener that only influences one thing is relatively small…in general –> want to be prepared for possibility of adjusting]

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

Would this be simpler or more complicated if we didn’t use a variable to keep track of the number of clicks?

A

More complicated because you would have to use the text.content property to update the count for each of the different clicks and assign it to the value.

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

Why is storing information about a program in variables better than only storing it in the DOM?

A

Because you could access it in different areas besides just in the DOM or tied to a specific element. It is more work to have to convert the data if you don’t use variables.

152
Q

What event is fired when a user places their cursor in a form control?

A

It fires the ‘focus’ event

153
Q

What event is fired when a user’s cursor leaves a form control?

A

It fires the ‘blur’ event

154
Q

What event is fired as a user changes the value of a form control?

A

The ‘input’ event is fired

155
Q

What event is fired when a user clicks the “submit” button within a < form >?

A

The ‘submit’ event –> It gets attached to the form element.

156
Q

What does the event.preventDefault() method do?

A

Blocks the default behavior of the event. Prevents what would typically happen.

Place it at the start of your code when using with submit.

157
Q

What does submitting a form without event.preventDefault() do?

A

It would automatically reload the page. (This should be prevented if no action attribute is provided – do NOT want to the page to refresh)

158
Q

What property of a form element object contains all of the form’s controls.

A

The elements collection → holds all the element’s controls

159
Q

What property of a form control object gets and sets its value?

A

Value Property

160
Q

What is one risk of writing a lot of code without checking to see if it works so far?

A

You could have code that doesn’t work properly and you’re not sure which stage of your code is the problem if you’re not checking it in stages.

161
Q

What is an advantage of having your console open when writing a JavaScript program?

A

You can check the progress of your code as you work as you expect it to

162
Q

Does the document.createElement() method insert a new element into the page?

A

No, it is not part of the DOM tree → it is just a new element node that is created

163
Q

How do you add an element as a child to another element?

A

You use the appendChild() method

164
Q

What do you pass as the arguments to the element.setAttribute() method?

A

You pass: the name of the attribute you want and then the value of that name. (It will convert the values into a string)

165
Q

What steps do you need to take in order to insert a new element into the page?

A

You need to first:
Create the element node that you want to insert into the page
Add text to the node (optional) or configuration

You need to then call “appendChild” method from the query selector of the element you want.

166
Q

What is the textContent property of an element object for?

A

You can use it to collect the text (retrieve it)

OR

You can assign it to a new value.

167
Q

Name two ways to set the class attribute of a DOM element.

A

You can use the className method on the DOM object

or you can use the element.setAttribute(‘name,’ ……) on the DOM object

168
Q

What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?

A

You can call that function in multiple places if you need to create multiple copies of that tree over and over.

169
Q

Give two examples of media features that you can query in an @media rule

A

device-width
Hover
Height
pointer

170
Q

Which HTML meta tag is used in mobile responsive web pages?

A

Viewport meta tag. Could contain something like:

171
Q

What is the event.target?

A

It is a property of your event object that states what specific element the event interacted with

172
Q

Why is it possible to listen for events on one element that actually happen its descendent elements?

A

Event Bubbling

173
Q

What DOM element property tells you what type of element it is?

A

The .tagName property tells you what it is

The actual name will be ALL capital letters

174
Q

What does the element.closest() method take as its argument and what does it return?

A

It takes a string of valid CSS selectors to match the element and its ancestors against

It returns the closest ancestor Element or itself that matches the selectors

[Closest – opposite of querySelector

175
Q

How can you remove an element from the DOM?

A

Use the remove ( ) method on the element you want to remove.

176
Q

If you wanted to insert new clickable DOM elements into the page using JavaScript, how could you avoid adding an event listener to every new element individually?

A

Use event delegation —

  • You only need to add an event listener to the nearest ancestor (it analyzes the bubbled event to find a match on one of its child elements.
  • Use the closest property –> make sure the event handler has a conditional that will address it. Check to make sure it came from the right spot.
  • You can then check if the event object’s target property to check what specific node was clicked
177
Q

What is the event.target?

A

It is a property of your event object that states what specific element the event interacted with

178
Q

What is the affect of setting an element to display: none?

A

It hides the element from the viewer and removes it from the document flow.

179
Q

What does the element.matches() method take as an argument and what does it return?

A

It takes a string that contains valid CSS selectors as its argument. Purpose: Used for verification

It returns “true” if the element matches the selector. It returns “false” if it does not.

180
Q

How can you retrieve the value of an element’s attribute?

A

You use the “getAttribute” method

The parameter is the string of the attribute’s Name of the value you want

181
Q

At what steps of the solution would it be helpful to log things to the console?

A

You would want to log things that are every line.

182
Q

If you were to add another tab and view to your HTML, but you didn’t use event delegation, how would your JavaScript code be written instead?

A

You would probably need lots of different event listeners to include & for each tab.

Would need to have a special function for each view.

183
Q

If you didn’t use a loop to conditionally show or hide the views in the page, how would your JavaScript code be written instead?

A

You would have many, many different conditional statements that would check for each possible variation of code.

184
Q

What is a breakpoint in responsive Web design?

A

The point that a media query is designed. Point where you’d have layout changes. (it’s the point where the container starts to break down in some way.

185
Q

What is the advantage of using a percentage (e.g. 50%) width instead of a fixed (e.g. px) width for a “column” class in a responsive layout?

A

Because the width can respond to changing sizes of the parent container → it can be more responsive in its design

186
Q

If you introduce CSS rules for a smaller min-width after the styles for a larger min-width in your style sheet, the CSS rules for the smaller min-width will “win”. Why is that?

A

ThesmallerwinsbecauseoftheCSScascadeandsourceorder

187
Q

What is JSON?

A

JavaScript Object Notation → it is a text-based format for representing data based on JavaScript object syntax

188
Q

What is JSON?

A

JavaScript Object Notation → it is a text-based format for representing data based on JavaScript object syntax

189
Q

What are serialization and deserialization?

A

Serialization = turning an object/array into a stream of bytes that you can store & send over the network

Deserialization is the reverse → turning a stream of bytes into an object/array

190
Q

Why are serialization and deserialization useful?

A

They allow you to transfer & store data across different networks and then convert them into objects. Brings into a format that is easily transferable everywhere

Allows you to save the state of an object

191
Q

How do you serialize a data structure into a JSON string using JavaScript?

A

Use: JSON.stringify( )

The parameter is the value that you want to convert into a JSON string

Return value: is a string of your data

192
Q

How do you deserialize a JSON string into a data structure using JavaScript?

A

Use JSON.parse( )

The parameter is the text that you want to parse

The return value = The Object, Array, string, number, boolean, or null value corresponding to the given JSON text.

193
Q

How do you deserialize a JSON string into a data structure using JavaScript?

A

Use JSON.parse( )

The parameter is the text that you want to parse

The return value = The Object, Array, string, number, boolean, or null value corresponding to the given JSON text.

194
Q

How do you store data in localStorage?

A

Set item method on the local storage

Arguments → keyname

195
Q

How do you retrieve data from localStorage?

A

Get Item method on the local sto

Arguments → keyname to retrieve

196
Q

What data type can localStorage save in the browser?

A

A string

197
Q

When does the ‘beforeunload’ event fire on the window object?

A

Before the browser refreshes, close the browser

The only time to use localstorage is WITH a beforeunload event.

198
Q

What is a method?

A

Is a function that is a property of an object → oftentimes it can be like a built-in task performed by an object “instance” or a task called directly on an object constructor

199
Q

How can you tell the difference between a method definition and a method call?

A

It has the property name of how you’re going to call it, and then key value:

Need a function keyword, a parameter list and then the opening code block.

A method call is dot notation. So it will include the name of the object.keyname() and then whatever argument is needed inside?

200
Q

Describe method definition syntax (structure).

A

Var objectName = {
property: function(parameter?) {
}

It includes an anonymous function?

201
Q

Describe method call syntax (structure).

A

Dot notation:

objectName.MethodName(argument).

202
Q

How is a method different from any other function?

A

It is different because it is a property of an object. So it is tied to whatever an object is? It needs to be called with its object.

203
Q

What is the defining characteristic of Object-Oriented Programming?

A

Defining characteristic is that: Objects can contain both data (as properties) and behavior (as methods)

Pairing data with behavior!

204
Q

What are the four “principles” of Object-Oriented Programming?

A

Abstraction
Encapsulation
Inheritance
Polymorphism

205
Q

What is “abstraction”?

A

Abstraction is way to take complex action or tool and to give it a simple tool. Provides a simple interface without needing to understand the complexities.

206
Q

What does API stand for?

A

Application Programming Interface

207
Q

What is the purpose of an API?

A

Give programmers a way to interact with a system in a simplified, consistent fashion (an abstraction)

Abstractions created that allow you to interact with a complex system. (You want to interface with an application)

208
Q

What is “this” in JavaScript?

A

It is an implicit parameter of all JavaScript functions meaning its value is determined by when it is called (not when it is defined)

209
Q

What does it mean to say that “this” is an “implicit parameter”?

A

It is available in a function’s code block even though it was never included in the function’s parameter list or declared with var

210
Q

When is the value of “this” determined in a function; call time or definition time?

A

It is determined by when it is called.

211
Q

What does this refer to in the following code snippet?

var character = {
firstName: ‘Mario’,
greet: function () {
var message = ‘It's-a-me, ‘ + this.firstName + ‘!’;
console.log(message);
}
};

A

It does not refer to anything because it has not been called.

It doesn’t exist yet because it is not called.

212
Q

Given the above character object, what is the result of the following code snippet? Why?

var character = {
firstName: ‘Mario’,
greet: function () {
var message = ‘It's-a-me, ‘ + this.firstName + ‘!’;
console.log(message);
}
};

character.greet();

A

The result would be: “It’s a me, Mario!”

It is including Mario, because the value of “this” was being determined at call-time. So the value is whatever is to the left of the property.

213
Q

var character = {
firstName: ‘Mario’,
greet: function () {
var message = ‘It's-a-me, ‘ + this.firstName + ‘!’;
console.log(message);
}
};

var hello = character.greet;
hello();

Given the above character object, what is the result of the following code snippet? Why?

A

The result of the code is: “It’s a me, undefined”

Because we cannot see the function being called, then you do not know what the value of this will be.

Because: it is being read as “window.firstName” which window does not have a first name.

214
Q

How can you tell what the value of this will be for a particular function or method definition?

A

if you cannot see the function being called, then you do not know what the value of this will be.

215
Q

How can you tell what the value of this is for a particular function or method call?

A

the value of this can be recognized as “the object to the LEFT of the dot” when the function is called (as a method).

Look for an object, if there is no “dot” then it is WINDOW.

216
Q

What kind of inheritance does the JavaScript programming language use?

A

Prototype-based (or prototypal) inheritance
Give certain behaviors (methods) or data (properties) to other objects.

217
Q

What is a prototype in JavaScript?

A

It is an object that contains properties and predominately methods that can be used by other objects

218
Q

How is it possible to call methods on strings, arrays, and numbers even though those methods don’t actually exist on strings, arrays, and numbers?

A

There is a prototype that each of the strings, array, and numbers have.

They can access it through prototypal inheritance

219
Q

If an object does not have it’s own property or method by a given key, where does JavaScript look for it?

A

It looks for it on a “prototype” object and arrays simply borrow those methods when they’re needed.

220
Q

What does the new operator do?

A

Lets developers create a user-defined object type that has a constructor function

  1. Creates a blank plain JavaScript object
  2. Assigns new instance [[Prototype]] based on constructor function’s prototype
  3. Executes the constructor function. The defined object becomes the “this” object
  4. (No constructor function will NOT return anything. they LACK return statements). “New instance” will get returned instead.
221
Q

What property of JavaScript functions can store shared behavior for instances created with new?

A

Prototype property.

222
Q

What does the instanceof operator do?

A

tests to see if the prototype property of a constructor appears anywhere in the prototype chain of an object.

Return value is a boolean

223
Q

What is a “callback” function?

A

A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action.

224
Q

Besides adding an event listener callback function to an element or the document, what is one way to delay the execution of a JavaScript function until some point in the future?

A

Use setTimeout function to delay something ()

Time Events

225
Q

How can you set up a function to be called repeatedly without using a loop?

A

setInterval function

226
Q

What is the default time delay if you omit the delay parameter from setTimeout() or setInterval()?

A

0

227
Q

What do setTimeout() and setInterval() return?

A

The returned timeoutID is a positive integer value which identifies the timer created by the call

It is a number.

228
Q

What is a client?

A

The service requesters → a piece of hardware or software that accesses a service made available by a server.

Example: A browser sending a request for a website

229
Q

What is a server?

A

Providers of a resource or service → computer hardware or software that provides functionality for programs

Examples: web server (serves web pages)
File server (serves computer files)

230
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

A

GET

Example:

GET https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages HTTP/1.1

231
Q

What three things are on the start-line of an HTTP request message?

A
  1. An HTTP method (a verb like “get” “put” or “post” or a noun like “HEAD” or “OPTIONS) → this describes the action to be performed
  2. The request target → usually a URL or absolute path of the protocol, port, and domain (where is the request going?)
  3. The HTTP version → defines the structure of the remaining message. Most likely (HTTP/1.1)
232
Q

What three things are on the start-line of an HTTP response message?

A
  1. The protocol version (usually HTTP/1.1
  2. The status code → success or failure of request
  3. Status text (brief informational description)

Example:

HTTP/1.1 404 Not Found.

233
Q

What are HTTP headers?

A

They specify the request or describe the body included in the message

let the client and the server pass additional information with an HTTP request or response. (Similar to the meta information in the head element of HTML)

234
Q

Where would you go if you wanted to learn more about a specific HTTP Header?

A

MDN

235
Q

Is a body required for a valid HTTP request or response message?

A

No, not all requests have one. (Those with GET, HEAD, DELETE, or OPTIONS, won’t have one).

Example of one without a body: 201

Only necessary when you have to send additional information

236
Q

What is AJAX?

A

A group of technologies that offer asynchronous functionality in the browser

(Allows you to access data and information from a server without having to reload the information).

Sending information, receiving information without needing to refresh the page.

237
Q

What does the AJAX acronym stand for?

A

Asynchronous Javascript and XML

238
Q

Which object is built into the browser for making HTTP requests in JavaScript?

A

XMLHttpRequest

239
Q

What event is fired by XMLHttpRequest objects when they are finished loading the data from the server?

A

Load event.

240
Q

Bonus Question: An XMLHttpRequest object has an addEventListener() method just like DOM elements. How is it possible that they both share this functionality?

A

Because they are both JavaScript objects used to interact and update information.

241
Q

What is a code block? What are some examples of a code block?

A

They are denoted by curly braces { }. They allow you to run a group of statements together.

examples include:
If else, for, do while, while, function, try catch (?)

242
Q

What does block scope mean?

A

It only exists within a specific code block, the values will not exist the same way outside the code block.

So, it might create a new variable within a code block

243
Q

What is the scope of a variable declared with const or let?

A

They are block-scoped, they cannot be redeclared

Previously –> They were constrained to function code blocks but not other code blocks (like loops)

Const/Let block-scoped for ALL blocks. Var is only function scoped

244
Q

What is the difference between let and const?

A

Const creates a read-only reference to a value. It cannot be REASSIGNED but the value can change. Must also provide it with a value (initialize a value)

Let can be mutable and reassigned (change values at anytime)

245
Q

Why is it possible to .push() a new value into a const variable that points to an Array?

A

Reference data types are mutable, you can change their content/properties. You can’t change their name binding or reassigned the variable.

Because, like with objects you can change the values within a const variable, you just cannot assign different values to it. You can update values within that array. You just cann’t assign a new array to it.

246
Q

How should you decide on which type of declaration to use?

A

You should decide based on whether a variable can be constant or not. If you want to update or change

Reassign/update use: Let

Prefer const –> only use let if you need to.

247
Q

What is the syntax for writing a template literal?

A

You can wrap your text in backticks ( )

It does count white space, so if you want new lines, make sure you indent properly.

You can add expressions using variables (string interpolation): ${ variable}

248
Q

What is “string interpolation”?

A

The ability to substitute part of the string for the values of variables or expressions.

Place variable in a special block: ${variable_name}

249
Q

What is destructuring, conceptually?

A

Object destructuring assigns the properties of an object to variables with the same names by default.

assigns properties of an object to individual variables.

Getting property values or array elements and assigning them all on one line

250
Q

What is the syntax for Object destructuring?

A

Let/const { property: variableName,…….} = object

Names of properties you want to pick, want to use a colon if you want to rename and an alias;

let { property1: variable1, property2: variable2 } = object;

251
Q

What is the syntax for Array destructuring?

A

let/const [x, y, z] = getScores();

Variable (let or const) Then: Square brackets [ ] and the variable names you want to pass = whatever array you are using

If you don’t include ALL indexes, it won’t have them all. Can use “…args” to get all the other values

252
Q

How can you tell the difference between destructuring and creating Object/Array literals?

A

Destructuring Array literals and object literals will have their braces BEFORE the assignment operator and creating will have them afterward.

253
Q

What is the syntax for defining an arrow function?

A

(…parameters) => expression; ← Use for defining an arrow function

(…parameters) => { statements } ← Use for defining arrow functions with multiple statements
If multiple statements it needs to include a return statement

(…parameters) => expression;
One parameter => expression;
() => expression;

Can have a normal code block OR return expression

254
Q

When an arrow function’s body is left without curly braces, what changes in its functionality?

A

It cannot have multiple statements or multiple lines and it no longer is required to have a return statement –> Return is implicit, it is implied.

Return expression (MUST be something type in console and can get immediate result)

255
Q

How is the value of this determined within an arrow function?

A

Value of this determined by its SURROUNDING code block.

Value of ‘THIS’ determined when arrow functions are DEFINED. Determined at definition time

because arrow functions establish this based on the scope the arrow function is defined within.

256
Q

What is a CLI?

A

Command Line Interfaces –> Text-based way to talk to a program

257
Q

What is a GUI?

A

Graphical user interface → things aimed at consumers of technology

Studio visual code is an example of GUI (Ajax / Code journal are examples)

Component of a full-stack project =

258
Q

Give at least one use case for each of the commands listed in this exercise:

man
cat
ls
pwd
echo
touch
mkdir
mv
rm
cp

A

man - look up manual or command information

cat - concatenate files and print on standard output
→ Can combine files together & text content
→ Can view content of folders, too

ls - lists directory contents (lists information about files)

pwd - print name of current/working directory (prints full filename of working directory). Tells where are you right now

echo - display a line of text & can write text that you can include in a file - Essentially console.log for the terminal

touch - change file timestamps (update access/modification times of files to current time)
Create files. (Touch often used for creating files)

mkdir - create directories (if they don’t already exist)
Create directors/files and parents/grandchild directories

mv - Move or rename files → rename source or move sources to directory

rm - remove files or directories
Need to remove or delete directories. It’s permanent and NO warning –> so be careful

cp - copy files and directories
Need to copy files or directories

259
Q

What are the three virtues of a great programmer?

A

Laziness – Reduce overall energy expenditure (write labor-saving programs others find useful)

Impatience - Write programs that don’t just react to your needs but anticipates them (or pretends to…)

Hubris - Makes you write/maintain programs others won’t say bad things about

AKA – work smarter not harder

260
Q

What is Node.js?

A

Program that allows JavaScript to be run outside of a web browser

261
Q

What can Node.js be used for?

A

Used for building back ends for web applications, command-line programs, or any kind of automation that developers wish to perform

Prevents code blocking & can allow other code to run in meantime due to callbacks

262
Q

What is a REPL?

A

Read-eval-print loop
It is a way to take a single user input, execute them and return the result to the user –

Example –> Chrome Dev Tools is an example of a REPL

263
Q

When was Node.js created?

A

Initially released in 2009

264
Q

What back end languages have you heard of?

A

Ruby, Python, C++, java, ruby, python, php, c#, elixir, clojure, zig, golang, scala, cyrstal,

265
Q

What is the process object in a Node.js program?

A

It is a global object that provides information about, and control over, the current Node.js process (it is always available) →

Information about the process (the instance of a currently running program)
Example – when you run an app it starts the process
They are self-aware

266
Q

How do you access the process object in a Node.js program?

A

It is global, you don’t have to declare it or assign it. It just EXISTS. You access it by name or globally

267
Q

What is the data type of process.argv in Node.js?

A

It is an array of strings (or string arrays)

PROCESS.ARGV returns an array containing the command line arguments passed when the Node.js process was launched.

268
Q

What is a JavaScript module?

A

It is a single .js file

Node.js supports modules using a system where there are many, many modules that each provide a small chunk of functionality and work together in concert

269
Q

What values are passed into a Node.js module’s local scope?

A

__dirname: directory name of current module
__filename: the file name of the current module
Exports: how this module can provide functionality/values to others (defines what a module exports)
Module: Reference to current module
require(): Can be how modules can receive information from other modules, JSON, and local files

270
Q

Give two examples of truly global variables in a Node.js program

A

Console

Process

271
Q

What is the purpose of module.exports in a Node.js module?

A

Allows you to export a module to be used by other modules

To export multiple things you would assign module.exports to an object that can continue multiple functions

272
Q

How do you import functionality into a Node.js module from another Node.js module?

A

You use the ‘require’ function with an argument of the relative path from the node.js module that you want to use

272
Q

How do you import functionality into a Node.js module from another Node.js module?

A

You use the ‘require’ function with an argument of the node.js module that you want to use

273
Q

What is the JavaScript Event Loop?

A

Event loop looks at the stack and looks at the stack queue and → If stack is empty it takes first thing in task queue and will run and push the callback back into the stack

274
Q

What is the difference between “blocking” and “non-blocking” with respect to how code is executed?

A

Blocking → essentially need to wait until the code is fully executed before you can proceed to the next block of codes → can’t do anything until its finished

Non-blocking is when you can run things in the event loop and can accept callback functions → can execute methods asynchronously

Any code being executed is ON the call stack.

Blocking code → Is ON the call stack, blocking anything else from being called

Non-blocking → any operation that is not on the call stack

275
Q

What is a directory?

A

A special file that lists other files

276
Q

What is a relative file path?

A

How you get from the working directory to another directory
(relative from your current position)

277
Q

What is an absolute file path?

A

Location of the file starting at the root directory
(From the entrance)

278
Q

What module does Node.js include for manipulating the file system?

A

fs.module is included

279
Q

What method is available in the Node.js fs module for writing data to a file?

A

The writeFile method

Arguments: (‘fileName,’ data, options, callback function)

280
Q

What is a client?

A

Hardware or software that sends the requests to a server

Example: browser sending a request

281
Q

What is a server?

A

The one that provides a service or function (like a web server, a file server) to a client

Giving information and providing the resources.

responds to a request and completes the service being requested

282
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

A

GET method

283
Q

What is on the first line of an HTTP request message?

A

The HTTP method → like “GET”, “PUT”, or “POST”

The request target (usually URL or absolute path)

The HTTP version (defines structure of remaining message)

284
Q

What is on the first line of an HTTP response message?

A

Protocol version (HTTP/1.1)

Status code → was it successful? Failure? Etc.

Status text - Brief information to describe status code

Example: HTTP/1.1 404 Not Found.

285
Q

What are HTTP headers?

A

let the client and the server pass additional information with an HTTP request or response.

Metadata about the message exchange. Key value pairs with information

They specify the request or describe the body included in the message

286
Q

Is a body required for a valid HTTP message?

A

It is optional (it can contain data associated with the request)

No, not all requests have one. (Those with GET, HEAD, DELETE, or OPTIONS, won’t have one).

287
Q

What is NPM?

A

Makes it easy for developers to share their code & for other developers to use that code & manage different versions of the code

It has three parts:
- The website
- The registry
- Command Line Interface (CLI)

288
Q

What is a package?

A

Reusable code that developers can create or use

A directory with one or more files (INCLUDING a package.json with some metadata inside)

289
Q

How can you create a package.json with npm?

A

Use: npm init

npm init –yes / npm init -y (picks defaults of a package.json)

290
Q

What is a dependency and how to you add one to a package?

A

3rd party code that your code needs to work.

291
Q

What happens when you add a dependency to a package with npm?

A

They are updated and listed in the package.json ‘dependencies’ key | Created a node_modules

292
Q

How do you add express to your package dependencies?

A

Use: npm install express

To use:
Var express = require(‘express’)
Var app = express();

293
Q

What Express application method starts the server and binds it to a network PORT?

A

The app.listen method

294
Q

How do you mount a middleware with an Express application?

A

App.use & app.method (METHOD = HTTP method of the request that middleware function handles, like GET, PUT, or POST → lowercase)

295
Q

Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?

A

req = The request object that represents HTTP requests (properties for request query string, parameters, body)

res = The response object that represents the the HTTP response

296
Q

What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?

A

Content-Type: application/json

297
Q

What is the significance of an HTTP request’s method?

A

It’s how the server respods to the client’s requests → so they define the routing of an application’s endpoints

The application will ‘listen’ for requests that match a specified route and method and when it finds a match it will specify the callback

298
Q

What does the express.json() middleware do and when would you need it?

A

It parses incoming requests with JSON payloads and returns middleware that only parses JSON and looks at the request.

It is needed when you have a request that is a JSON payload

299
Q

What is PostgreSQL and what are some alternative relational databases?

A

Post Gress Queue El → it is a relational database management system → it can also handle multiple concurrent connections from clients

Alternatives → MySQL, SQL Server (Microsoft), Oracle (Oracle Corporation)

300
Q

What are some advantages of learning a relational database?

A

Most widely used database → used in lots of devices and applications | lots of databases driven by same language

301
Q

What is one way to see if PostgreSQL is running?

A

Use sudo service postgresql status → way to see if Postgres is running

302
Q

What is a database schema?

A

A collection of tables → it defines how the data should be organized & interact with each other
Needs to be defined upfront

The rules for how the data can be stored
Schema-less databases are in noSQL
Tells data upfront what data should look like

303
Q

What is a table?

A

The relations of a relational database
List of rows where each has attributes
Similar → array of objects where all have same

304
Q

What is a row?

A

In a table → same set of attributes (columns) of your data

Each row is a record in your database that will have the same set of attributes (columns)

305
Q

What is SQL and how is it different from languages like JavaScript?

A

Primary way of interacting with relational databases
It is a way to retrieve, create, and manipulate data in relational databases

It’s different from JavaScript (which is imperative, tell it what to do and how) → instead, it is declarative (you describe the results you want → HTML & CSS are declarative)

SQL describes what we want & SQL figures it out

306
Q

How do you retrieve specific columns from a database table?

A

You use the “select” keyword → followed by a comma-separated list of column names (double quotes). THEN → use the ‘from’ clause to specify which table to retrieve data from
End it in a semicolon

MUST end in a semicolon

307
Q

How do you filter rows based on some specific criteria?

A

FILTERING – use the “where” clause with a condition
You use the “where” clause after the from clause
It checks for whatever you provided in single quotes → being compared using a comparison operator

308
Q

What are the benefits of formatting your SQL?

A

consistent style and readability.

309
Q

What are four comparison operators that can be used in a where clause?

A

< , > , !=, =

310
Q

How do you limit the number of rows returned in a result set?

A

Use the limit selector → it comes LAST in the sequence; it is a literal integer number to specify # of rows that you return

311
Q

How do you retrieve all columns from a database table?

A

Use the * asterisk
select *
From “_____”;

312
Q

How do you control the sort order of a result set?

A

Use the “order by” clause in the select statement to control the order of the result set

313
Q

How do you add a row to a SQl Table?

A

Use the “insert into” keyword → You first specify which table you are inserting into. Then, list the columns.

** Need to specify the attribute names. Column Names NEED to match the values inserting

Then, you use values ( values). And if you want to return a value state: returning *

314
Q

What is a tuple?

A

List of values that are being inserted into a row. There is an order that matters ( …values… )

315
Q

How do you add multiple rows to a SQL table at once?

A

You just separate a tuple of values with commas

316
Q

How do you get back the row being inserted into a table without a separate select statement?

A

Use the “returning” clause
If you want all the columns use * | if you want just one column, specify it. Just LIKE select, can specify what you want.

317
Q

How do you update rows in a database table?

A

Use an update statement to update rows in a database table →
update “table”
set “column” = value
where clause

If you want to update multiple columns, just use a comma-separated list of arguments in the “set” clause

318
Q

Why is it important to include a where clause in your update statements?

A

Because if you DONT include it, it will update EVERY column that you have <– If you don’t do it, you will crash everything

319
Q

How do you delete rows from a database table?

A

Use the delete statement

SHOULD include a where clause to specify WHERE to delete it from

320
Q

How do you accidentally delete all rows from a table?

A

You don’t specify what exactly to delete from a particular table. If you JUST use the table name, you delete everything.

321
Q

What is a foreign key?

A

SHARED DATA VALUE
*****

322
Q

How do you join two SQL tables?

A

Use the “join” clause after “from” clause and tell the database sever to link the tables by whatever column they have in common

First → 1. Select what you want to combine:
If multiple things use: “tableName”.”attribute”
Then → Use “from” clause for your first thing
Then → Use “join” ______ using (______)
What follows “using” is the exact location to insert it IN PARENTHESES
Include as many join…using…that you need
Can follow with other things like “where” and “limit” and “order by…”

323
Q

How do you temporarily rename columns or tables in a SQL statement?

A

You can alias the common names →
Use the “as” keyword
Example: Change “name” of two tables such as:
Select “products”.”name” as “product”,
“Suppliers”.”name” as “supplier”
Can also “alias” tableNames to streamline process of repeating names of tables.

324
Q

What are some examples of aggregate functions?

A

max() →
Select max (‘price’) as “highestPrice”
From “products”;
avg() →
Select avg(“price”) as “averagePrice”
From “products”;
count() →
Select count(*) as “totalProducts”
From “products”

Good practice to alias your columns

Others: min() | sum () | every ()

325
Q

What is the purpose of a “group by” clause?

A

Purpose is to separate rows into groups and perform aggregate functions on those groups of rows

326
Q

What are the three states a Promise can be in?

A

Pending → The initial state (not fulfilled, nor rejected)
Fulfilled → operation was completed successfully
Rejected → operation failed
Once it is fulfilled or rejected there’s no going back

327
Q

How do you handle the fulfillment of a Promise?

A

Use the promise.then method → It can be fulfilled with a value → it is queued up by a promise’s then method

Promise.then method takes up two arguments (value → value of the promise, or reason if rejected)
Value might have an “onFulfilled” function that is called (could also be an identity function)

Once it is fulfilled, the “onFulfilled” or “onRejected” handler function will be called asynchronously

then(onFulfilled)
then(onFulfilled, onRejected)

then(
(value) => { /* fulfillment handler / },
(reason) => { /
rejection handler */ },
);

328
Q

How do you handle the rejection of a Promise?

A

Catch returns a method and deals with rejected cases → behaves similar to calling (then) → you have to provided the “onRejected” function in its argument

p.catch(onRejected)

p.catch(function(reason) {
// rejection
})

329
Q

What is Array.prototype.filter useful for?

A

Useful for filtering an array down to just specific elements that pass a certain test/criteria that you set and you don’t want to modify the original array

330
Q

What is Array.prototype.map useful for?

A

Useful for when you want to create a new array that has transformed elements from another array

331
Q

What is Array.prototype.reduce useful for?

A

Combining elements of an array into a single value
It allows you to do things like sum an array, or multiple all the contents together and just return one thing

Example → Bank account – calculate your total based on all the transactions in an account

Collapse an array of elements into a final value

332
Q

What is Webpack?

A

It lets you bundle your JavaScript applications (both ESM and CommonJS) intro an output file (dis/main.js)

Start with multiple modules and can end up with fewer files

Create a bundle

It is a module bundler
and extend to support different assets like images, fonts, and stylesheets

333
Q

How do you add a devDependency to a package?

A

You run the npm install –save-dev and then the devDependencies that you want to use:
Webpack
webpack-cli

Npm install webpack –save-dev

devDependencies are packages that are only needed for local development and testing

334
Q

What is an NPM script?

A

It’s a way to bundle commands together → they can be a string of compands that allow you to do a specific task → commands you can enter into the terminal

Command line command that is a nickname

335
Q

How do you execute Webpack with npm run?

A

You do: npm run build to execute a specific script
To execute scripts you would use:
Npm run …. (whatever you named it)
Npm run build

Can add any arbitrary script to the keys

336
Q

What is “syntactic sugar”?

A

Syntax in programming that is designed to make things easier to read and express → express things more clearly/concisely

Oftentimes it is shorter!

337
Q

What is the typeof an ES6 class?

A

They are constructor functions

338
Q

Describe ES6 class syntax.

A

You use class NameOfClass {
constructor Method (parameter) {
this.parameter = parameter;
}
method(parameters) {
return ……
}
}

339
Q

What is “refactoring”?

A

Process of restructuring existing code (how it factors) without changing its functionality→ improving design, structure or implementation while preserving its functionality

TRULY refactoring = behavior is the SAME

340
Q

How are ES Modules different from CommonJS modules?

A

ECMAScript Modules are official! CommonJS is not official so you need other things to make CommonJS to support

Two parts: declarative syntax (for importing/exporting)
- module (import/export)
Programmatic loader API – configure how modules are loaded – Asynchronous loading support

341
Q

What kind of modules can Webpack support?

A

ECMA and CommonJS will work | npm packages

Supports: ECMA modules | CommonJS module | AMD

342
Q

What is React?

A

JavaScript library for creating user interfaces → a painless way to create interactive UIs (design simple views for each state in an application)

343
Q

What is a React element?

A

It describes what you want to see on the screen → they are plain objects (building blocks of react apps)

React.createElement(
type,
[props],
[…children]
)

344
Q

How do you mount a React element to the DOM?

A

The render method will mount it to the DOM

  1. Create the element
  2. Query the DOM for where you want the place element
  3. Use ReactDOM.createRoot(domElement)
  4. Use render(element)
345
Q

What is Babel?

A

It is a compiler

It is a toolchain that converts ECMAScript 2015+ into a backwards compatible version of JavaScript in current and older browsers or environments

OR for alternative scripts

346
Q

What is a Plug-in?

A

It is a software component that adds a specific feature to an existing computer program → it enables customization

347
Q

What is a Webpack loader?

A

They are transformations that are applied to source code of a module → pre-process files as you import or “load” them
Way to handle “front-end build steps → can transform files from a different language to JavaScript

Loaders provide a way to customize the output through their preprocessing functions

A middle connector –

348
Q

How can you make Babel and Webpack work together?

A

You need to install babel-loader as a devDependency

349
Q

What is JSX?

A

It is a syntax extension to JavaScript → it’s a way to use with React to describe what the UI should look like (similar to a template language)

JavaScript PLUS some stuff – JSX extension to JavaScript that you compile TO JavaScript

350
Q

Why must the React object be imported when authoring JSX in a module?

A

Because JSX compiles calls to React.createElement, so if it’s not there, then it’s not going to work! → Needs to be in scope

351
Q

How can you make Webpack and Babel work together to convert JSX into valid JavaScript?

A

You need to make sure that you have webpack (dev-dependency) & babel-loader installed (dependency) → Then, also make sure you have the babel plug-in:
@babel/plugin-transform-react-jsx

Installed too, so that the babel-loader will use it when the webpack is run

Need to have a webpack.config.js file that will have the Babel plugins loaded

352
Q

What is a React component?

A

Reusable Function or Class that can let you split UI into independent, reusable pieces and think about each piece in isolation

They accept inputs called “props” and return React elements that describe what should appear on screen

353
Q

How do you define a function component in React?

A

Similar to a JavaScript function –
function Name (capitalize the name to be in scope, bundlers/compilers won’t know unless its capitalized) (props)
Props = properties of argument that you are passing.)
Returns a REACT element
Can also use an ES6 class to define a component

354
Q

How do you mount a component to the DOM?

A

Similar steps with the way you would mount a JavaScript element to the DOM
BUT, with the element you are defining you would use something like:
const element = < ComponentName name=”value” />
Call the root.render( ) with the react element
It will call the component with whatever props are passed
It will return whatever the function has happen
Then it will update the DOM

355
Q

What are props in React?

A

They are properties of an element that are an object (they look like HTML attributes)

Basically – key-value pairs

356
Q

How do you pass props to a component?

A

When you are rendering a Component, in your argument (or variable you are creating) →

< ComponentName prop1=”value”….. />

Whatever follows the ComponentName will be passed as part of the props component

PropName = Value
- IF want to use template Literals need to pass { }
- If it’s a JavaScript expression must be wrapped in { }

357
Q

How do you write JavaScript expressions in JSX?

A

MUST be in curly braces (way to inform that it’s a JavaScript expression.

358
Q

How do you create “class” component in React?

A
  1. Class keyword
  2. Name of componeent
  3. Extend the react.component
  4. NEED a render method (and expects it to return react elements)

You need to extend: React.Component
Only method you MUST define in a react.component sub class is “render()”
All others are optional

359
Q

How do you access props in a class component?

A

It is a property of “this”

You need to use “this.props.propName” to access whatever prop you want in a class component

360
Q

What is the purpose of state in React?

A

It initializes the local state of a React object → to contain data or information about the component

it is often assigned in the constructor directly (all other methods use the this.setState( )

A component’s state can change over time; whenever it changes, the component re-renders

361
Q

How to you pass an event handler to a React element?

A

IDEA → When you return the react element. You pass it as a PROP
Example: OnClick…..

(Make sure whatever method associated with OnClick & changing the state –> Needs to be BOUND)

362
Q

What are controlled components?

A

Controlled components are when an input form element has its value being controlled by React

Input’s value will always be driven by the React state → allows you to pass the value to other UI elements or reset it from other event handlers
Basically → The React state is the “single source of truth”

363
Q

What two props must you pass to an input for it to be “controlled”?

A

The: this.state.value ← This makes the React state the source of truth for what the form’s value will become

Value
onChange ← Way to handle changes

handleChange → runs every keystroke to update the React state & displayed value will update as the user types

364
Q

What Array method is commonly used to create a list of React elements?

A

You use the map method

365
Q

What is the best value to use as a “key” prop when rendering lists?

A

A Key is a special string attribute you need to include when creating lists of elements
They need to be given to elements inside the array to give the elements a stable identity
BEST way → use a string that uniquely identifies a list item among its siblings
YOu would use IDs from your data as keys
Or, you can use the item index as a last resort (NOT recommended though)

366
Q

What does express.static() return?

A

It returns a FUNCTION →
It returns a middleware function!
App.use NEEDS to use a middleware

367
Q

What is the local __dirname variable in a Node.js module?

A

It is the directory name of the CURRENT module
Path to the directory that THIS module is in
Need to state a full absolute path

368
Q

What does the join() method of Node’s path module do?

A

Joins all given path segments together using the platform-specific separator as a delimiter then normalizes the resulting path
Makes sure that it creates a path that works
Accounting for all the . .

Must be a string!

Way to apply JavaScript, CSS, and HTML TO the browser

369
Q

What does fetch() return?

A

It returns a promise → it resolves with a response object

370
Q

What is the default request method used by fetch()?

A

The default method is: GET

371
Q

How do you specify the request method (GET, POST, etc.) when calling fetch?

A

To specify a request method you need to place it in as an object:

fetch(destination, { method: method }

372
Q

When does React call a component’s componentDidMount method?

A

It is invoked immediately after a component is mounted (inserted into the tree)

373
Q

Name three React.Component lifecycle methods.

A

componentDidMount( )
render ( )
componentDidUpdate ( )
componentWillUnmount ( )
constructor ( )

374
Q

How do you pass data to a child component?

A

Pass a function as a prop to the child component