Coding FlashCards

1
Q

Give five examples of HTML element tags.

A
  1. html
  2. head
  3. title
  4. body
  5. p tag
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the purpose of HTML attributes?

A

are a modifier of an HTML element type

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

Give an example of an HTML entity (escape character)

A

” © “ = copyright

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

How do you indicate the parent folder in a path?

A

Use ../ to indicate the folder above the current one, then the file name

Example: ../index.html

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

How do you indicate the child folder in a path?

A

Use the name of child folder, then the file name

Example: music/listings.html

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

How do you indicate the grand parent folder in a path?

A

Repeat the ../ to go up two folders, then follow with the file name.

Example: ../../index.html

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

How do you indicate the current folder in a path?

A

Use the file name

Example: index.html

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

What purpose do the thead and tbody elements serve?

A

thead: separate chunks in your table (table header)
tbody: the body (information) of table

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

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

A

Numbers, finances, anything you can put in an excel sheet

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

What is an absolute URL?

What is a relative URL?

A

Absolute URL: When you link to a different website, the value of the href attribute will be the full web address for the site

Relative URL: When you are linking to other pages within the same site, you do not need to specificy the domain name in the URL (example: Home)

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

What attribute do you have to match between a label and an input?

A

for and id

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

What type of input allows you to select multiple items in a dropdown?

A

select

select needs to work with the element

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

What does the element do?

A

uses the action attribute to indicate the page that the data is being sent to

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

What does the element do?

A

indicates the purpose of each form control

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

Give three examples of type attributes for HTML elements.

A

type
id
value

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

Give three examples of type attributes for HTML elements.

A
password
email
radio
checkbox
text
calendar
phone number
button
color
date
time
file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Why would we choose specific element types when we have elements such as div and span which can be used for anything?

A

Provide elements that provide content

SEO (search englines)

Accessibility

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

What factors contribute to a well-designed HTML document?

A

Proper formatting (indenting)

Using the correct functions

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

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

A

property, value, selector, declaration

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

How are key/value pairs related to CSS?

A

properties and values

name that correlates to a value

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

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

A

RBG Values
HEX
Color Names

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

Why must you have backup fonts assigned when selecting custom fonts?

A

In case the user does not have that font installed

If the fall back doesn’t work, it will default to New Times Roman

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

What CSS properties make up the box model?

A

padding, border, margin

content is not a CSS property

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

Which CSS property pushes boxes away from each other?

A

margin

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

Which CSS property pushes box content away from its border?

A

padding

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

What are three important considerations for choosing fonts?

A

Readability, cross browsers reading, theme, target market

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

In what situations might you need to apply styling to a single element multiple times in one stylesheet?

A

Mobile responsiveness

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

What is source order?

A

order that CSS rule is written

Styling provided for an element LAST in stylesheet

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

What is inheritance?

A

If the child element does not have a value, it would look to the parent element for a value

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

Why might CSS include this feature?

A

To set font related properties instead of setting it individually

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

Is inheritance a good tool to use for styling? If so, on what occasions?

A

Yes, because you can simplify setting properties

although its on the weaker side - any direct styling will override it

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

When is ! important a good tool to use?

A

NEVER. It’s used to override a template that you have no control over or for people writing libraries for CSS

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

What is specificity?

A

A browser decide which CSS property values are the most relevant to an element.. then apply it

The more unique, the stronger it’ll be

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

How is specificity calculated?

A

determined by the number of each selector type in the matching selector

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

Why might CSS include this feature?

A

To make things more precise to an element and not worrying about it getting overwritten

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

What is the order of selector strengths for CSS specificity (commonly referred to as the Specificity Hierarchy)?

A

id
class
element
universal selector

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

What is the CSS Cascade?

A

All the factors to determine what style is applied

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

What are CSS pseudo-classes useful for?

A

adds a specific selector to an element

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

What is the difference between the :first-child pseudo selector and the :last-child pseudo selector?

A

allows you to visually manipulate an element by skewing, rotating, translating, or scaling:

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

What does the transform property do?

A

allows you to visually manipulate an element by skewing, rotating, translating, or scaling:

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

What is the difference between the :first-child pseudo selector and the :last-child pseudo selector?

A

The :first-child CSS pseudo-class represents the first element among a group of sibling elements.

The :last-child CSS pseudo-class represents the last element among a group of sibling elements.

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

What are 3 examples of what can be done with CSS transitions?

A

duration, timing, and delay

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

Are all properties able to be transitioned?

A

yes

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

Why is CSS transition a useful tool?

A

create elements to be more visually pleasing

another way to make website more comfortable for users

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

How do block-level elements affect the document flow?

A

start on a new line in the browser window

examples: h1, p, ul, li

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

How do inline elements affect the document flow?

A

some elements will continue on the same line as neighboring elements

examples: a, b, em, img

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

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

A

100% (takes up any space available)

height: auto (same as content)
width: 100%

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

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

A

takes up space to accommodate its contents

height: auto (same as content)
width: auto (same as content)

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

What accessibility considerations must be considered when choosing HTML elements?

A

when you want emphasize through a spoken word (such as strong, em, del)

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

What is the difference between display: none and visibility: hidden?

A

display: none = hides an element on a page.. element will not be on the page at all (no spaces, no gaps)
visbility: hidden = hides an element.. all the other elements moves over it (shows a space for the hidden element)

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

What is the difference between the block, inline block, and inline display properties?

A

block: takes up full width
inline: takes up minimum space

inline block: takes up minimum space but with a set height and width

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

What is the initial display property of div s?

A

block

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

What is the difference between the block, inline block, and inline display properties?

A

block: takes up full width
inline: takes up minimum space

inline block: takes up minimum space but with a set height and width (you can resize height and width)

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

Why are CSS resets helpful for cross browser compatibility?

A

its good to be consistent across multiple browsers

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

Why is it important to be mindful of what you reset with your CSS resets?

A

you don’t want to reset everything as it’ll give us a starting point. you just want to get rid of things that will cause problems between different browsers

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

What is an argument against using CSS resets?

A

a lot of the styles are eventually overridden by our main stylesheet, which means that the reset styles unnecessarily add to page load time

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

What is an argument against using CSS resets?

A

a lot of the styles are eventually overridden by our main stylesheet, which means that the reset styles unnecessarily add to page load time (more work for browser)

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

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

A

Position default = Static

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

How does setting position relative on an element affect document flow and where the element appears on the page?

A

moves an element in relation to where it would have been in a normal flow

shift where it would normally be

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

How does setting position absolute on an element affect document flow and where the element appears on the page?

A

removed from document flow entirely and looks for the first non-static parent it can find to position itself against

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

What are the box offset properties?

A

top, bottom, left, and right

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

What were floats originally designed for?

A

to allow developers to float text around image elements similar to the way newspapers and magazines would display text. For example:

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

What are clears for with floats?

A

allows you to say that no element should touch the left or right hand sides of a box

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

What are some of the downsides for using floats in layout design?

A

Element is removed from the document flow.

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

What is the default flex-direction of a flex container?

A

row (left-to-right)

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

What is the default flex-wrap of a flex container?

A

no wrap = all flex items will be on one line

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

Why should flex-box not be used for building complete web page layouts?

A

cant make complex lay-outs

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

Why is it important to use a grid system for CSS layouts?

A

easy to adjust things in teams

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

Why is it important to use a grid system for CSS layouts?

A

container, column, row.

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

Why is it a good idea to use percentages for grid column widths?

A

because if you open your website in a crazy display you want your website to be contained.

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

How do you think building this layout would be different without a grid system?

A

T WOULD NOT BE FUN

It would be very tough…

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

What advantages do you see with using a grid system?

A

organized (easier to work with),

user friendly (easier for them to use and read)

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

Why are media queries crucial to responsive grid designs?

A

automatically adjust the set width of the container class depending on the size of the current browser window

without it, building responsive designs is almost impossible (it is important for the content of the website to adapt to the screen it is displayed on)

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

What is a variable?

A

to temporarily store the bits of information it needs to do its job

container that we can store data in and reference by data to be used later on

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

Why are variables useful?

A

ability to have something you can reference and use later

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

What two special characters can a variable begin with?

A

$ or underscore (_)

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

How do you declare a variable?

A

using the VAR keyword

ex. var quantity

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

Which words cannot be used as variable names?

A

JavaScript keywords

(if, while, var, const)

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

What is a number in JavaScript?

A

just a number = 12 , 2 , 3

data type

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

What is an arithmetic operator?

Name four of the arithmetic operators?

A

+ , - , / , *,

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

What is the order of execution?

A

PEMDAS!!!

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

What is a string?

A

data type that consists of letters and other characters in a pair of quotes

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

What is the string concatenation operator?

A

joining two or more strings to create a single value using the string operator (+)

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

What is the difference when it comes to using single quotes or double quotes ( ‘ ‘ or “ “ )?

A

nothing

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

How do you escape quotation characters?

A

backwards slash before any type of quotation mark

example: a href="sale.html\

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

What is type coercion?

A

one data type has been converted from one data type to another

ex. concatenation
var phrase = 'I am'
var age = 29
var phrase2 = ' years old'
phrase + age + phrase2
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
87
Q

What is a number in JavaScript?

A

data type that contains a number

88
Q

What is an arithmetic operator?

A

mathematical operator

89
Q

Name four of the arithmetic operators?

A

multiplication, division, addition, subtraction

90
Q

What is a boolean?

A

data type with the values of true or false

91
Q

What is a comparison operator?

A

used to compare values to test for true or false comparisons

92
Q

What is the difference between undefined and null?

A

null: empty or non-existent, must be assigned (ex. vacant lot in a city - i want to put something here but not right now)
undefined: value is not assigned; not on purpose (ex. a vacant lot in a city - could be empty for a variety of reasons)

93
Q

What is the difference between a parameter and an argument?

A

parameters: variables
arguments: values

94
Q

What is a function?

A

performs a specific task

95
Q

Define a function named addTwoNumbers with two parameters

A

function addTwoNumbers(a, b) { }

96
Q

How do you call a function?

A

using the statements in between the parenthesis

97
Q

What are the parts of a function definition?

A
functionKeyword functionName() {
return statement
}

name function
parameter list
return code block

98
Q

CODE READING: var firstName = “Michael”;

A

The string, Michael, is being assigned as the value for the variable first name

99
Q

CODE READING: var address = number + street

A

the value of the variable number is being concatenation (+) with the variable of the value street. The result of this expression is the variable address

100
Q

CODE READING: var area = height * width

A

the variable stored for height is multiplied by the variable stored for width. The result of this expression is the variable address

101
Q

CODE READING:

function multiplyTwoNumbers(a,b) {
return a*b
}
A

Function definition named multiplyTwoNumbers with the parameters a and b with an opening curly brace for the code block. The value for variable a is being multiplied with the value for the variable b and the result of the expression is being returned to the function. there is a closing curly bracket for the code block.

102
Q

Why are functions useful?

A

you can reuse them.

103
Q

Why is it important to understand truthy and falsy values?

A

important for doing comparisons

104
Q

What is the difference between null and undefined?

A

null: empty or non-existent, must be assigned by a human (ex. vacant lot in a city - i want to put something here but not right now)
undefined: value is not assigned; not on purpose (ex. a vacant lot in a city - could be empty for a variety of reasons)

105
Q

Why do you always use === for comparisons?

A

to execute a true equality test

106
Q

Why do you want to avoid using == for comparison?

A

it loosely compares 2 values for equality after convert both values to a common data type

107
Q

Do all if statements require an else statement?

A

no

108
Q

What is the proper syntax for using the or operator?

A

x == 5 || y == 5 is false

109
Q

What is the primary use case for switches?

A

used to perform different actions based on different conditions.

110
Q

Does the default case have to be at the bottom of the switch statement?

A

no

111
Q

What happens if there is no break statement between cases?

A

the (default or else) will be executed even if the evaluation does not match the case

112
Q

CODE READING: switch (operator)

A

Switch statement checking the EXPRESSION of operator

113
Q

Difference between if and switch statement

A

ex. friend ask for a banana

if statements (checks one at a time)
- you take one fruit out at a time until you get to the banana
switch statements (sees the full landscape and goes directly to the value you're looking for)
- you have the banana on a stand
114
Q

When should you use bracket notation over dot notation with objects?

A
  1. name of the property or method contains a special character (like a dash)
  2. name of the property is a number
  3. a variable is being used in place of the property name
115
Q

What is a property in relation to JavaScript objects?

A

variables.

116
Q

How do you remove a property from an object?

A

use the delete keyword followed by object name and property name

ex. delete hotel.name

117
Q

What is an object in JavaScript?

A

collection of related/reference data (contains memory type)

primitive data(contains actual value)

118
Q

How do you create an object literal?

A

var object = { };

var object2 = new Object( )
^ shorten syntax for creating a new object (not mainly used)
119
Q

What is a property in relation to JavaScript objects?

A

a place where we can store data inside of an object

120
Q

What is an array in JavaScript?

A

list (or set of values)

121
Q

How do you create an array literal?

A

square brackets

122
Q

Arrays have a property named length. Because arrays have a properties, what other data structure are they similar to?

A

(length is usually tied to an array = array.length)

123
Q

CODE READING: colors[1]

A

value at the one index in the color array

DO NOT SAY FIRST…

124
Q

CODE READING: colors[2] = “green”

A

a string value of green which is being assigned to the value at the 2 index of the color array

125
Q

CODE READING: var amountOfStudents = students.length

A

length property of the students array being assigned to the variable amountOfStudents

126
Q

What are some good use cases for using objects inside arrays?

A

student data (name, age, grade)

insurance policy (name, plan, cost)

user info (email, password, full name)

127
Q

What is the primary advantage to storing your selected elements in a variable?

A

if you need to use the same element more than once

128
Q

How can you better prepare when writing HTML for DOM manipulation in your JavaScript code?

A

add ids and classes

129
Q

What are the differences between innertext and textContent?

A

textContent gets the content of all elements, including and <style> elements. In contrast, innerText only shows “human-readable” elements.</style>

130
Q

What datatype are the values you remove from a text input?

A

anything you pull out from an input is going to be a string

131
Q

Why is it so important to be able to dynamically update text?

A

so the user can interact with the website.

132
Q

What are some of the drawbacks of HTML Event Handler Attributes?

A

better to separate the JS from HTML

133
Q

Why is the Window.event property to be avoided in new code?

A

This property is not universally supported and even when supported introduces potential fragility to your code

134
Q

Why is the Window.event property to be avoided in new code?

A

This property is not universally supported and even when supported introduces potential fragility to your code

changes with every single event and can easily go to a different event than you’re trying to work with
–ex. document.addEventListener(“mouseover”, console.log)

135
Q

What is the difference between the getElementById() method and the querySelector() method?

A

The querySelector() method returns the first element that matches the specified css selectors. For example: document.querySelector(“div.target > span”);

The getElementById() method returns the first element that matches the given id in the DOM. For example: document.getElementById(“idOfSpan”);

136
Q

Who passes in the event object into the handleClick callback function?

A

JavaScript language with automatically do it

137
Q

Does a callback function require a name?

A

no (but you should name your functions)

this would be called an anonymous function

138
Q

What is the purpose of a loop?

A

to repeat the same, or similar, code a number of times

139
Q

currentTarget

A

targets the element that the event is dealing with

140
Q

Why might there be different kinds of loops?

A

different situations

141
Q

What is the purpose of a conditional expression as it relates to loops?

A

when you can stop

142
Q

Could a loop potentially go on forever?

A

yes

143
Q

Could a loop never start?

A

yes

144
Q

How does a for loop differ from a while loop?

A

while: don’t know how many times you need to do something but do know where you’ll stop (Ex. walking to leasing office.. don’t know how many steps but i do know where to stop)
- -need a stopping place

for: know the number of items (aka arrays) we’re dealing with (ex. checking off boxes on a stack of cards – set number in a deck of cards)
- -need an initialization, condition, and final expression

145
Q

What potential use cases are there for for loops?

A

arrays (example: search engine)

146
Q

Which pieces of information provided in the parentheses for a for loop are mandatory?

A

none are mandatory

example: for(;;) –> but you could use while loop instead

147
Q

What is a for in loop?

A

using a loop when you don’t know how many things there are in an object

148
Q

How do you target the value of a property in an object.

A

put the variable of the property in a bracket notation

149
Q

When should you use a for in loop?

A

loop over an object

150
Q

When should you use a for in loop?

A

loop over an object [and do the same action for each property]

151
Q

When should you use a for in loop?

A

loop over an object [and do the same action for each property]

least use type of loop

152
Q

node

A

a piece in your document

153
Q

What is the difference between the parentNode and parentElement properties?

A

parentNode: document of the parent element

parentElement: parent element of the current node (always an element)

154
Q

Why is it important to be able to traverse the DOM?

A

whitespace nodes and allows us to find information on elements around us

155
Q

What kind of information is useful to store in custom attributes?

A

use data attributes to store information

example USING DATA SET

156
Q

What are two ways to target elements on the DOM?

A

querySelector (selects first element it finds) or getElementbyID or

querySelectorAll (looks for every single element that may have that class or attribute - but will always return a node list)

157
Q

What is another way to add a text node to an element other than using textContent.

A

inner text (use when you want to avoid whitespace node)

document.createTextNode

158
Q

How do you create a HTML element using vanilla Javascript?

A

create element method of the doc element object

159
Q

Why is using loops and arrays for creating multiple dom elements preferable to creating them one at a time?

A

DRY (do not repeat yourself)

saves you time!!

160
Q

Why are arrays preferred over objects for the functionality referenced in question 1?

A

arrays have order and have index

objects do not have order

161
Q

How would you alter the game to make the choice from 1 - 500?

A

var randomNumber = Math.floor(Math.random() * 500) + 1

math. random() = function that gives you a decimal between 0 and 1 but not actually 1… gives opportunity for random percentage.
math. floor() method chops off the decimal point; it’ll round it off to an integer.

+1 = if i get 99.999 repeating, after math.floor it’ll be 99 instead of 100. Which is why you add 1.

example: range between 25 - 50
math.floor(math.random() * (50 - 25 + 1)) + 25
[THAT SHOWS MAXIMUM MINUS MINIMUM AND ADDING 1 TO INCLUDE 25]

162
Q

What are the disadvantages of inline styling via JavaScript?

A

you do not want to mix up languages

major problems with inline styling

163
Q

What things do you have to consider when building a reset game function?

A

generating a new number to guess if replaying

setting everything back to its initial value

164
Q

Why is it important to be able to retrieve and use data from inputs?

A

get information from the user and choose what to do with that data

communicating with the user

165
Q

Why is it dangerous to assume you have the correct data when creating elements?

A

you should never assume the user is using the correct information

166
Q

What is jQuery?

A

jquery is a library added to javascript to perform css

167
Q

What is the jQuery selector function?

A

$()

168
Q

What does the jQuery selector function return?

A

return the list of elements that was asked

169
Q

Why would someone use jQuery over vanilla Javascript?

A

easier to select elements, chain actions, trim syntax (shorter codes), works across all browsers

170
Q

What are some downsides from using jQuery over vanilla Javascript?

A

hides the complexity, develop a skill set that’s not permanent

you have to pull in a code from a network

171
Q

Why do we use the tag at the bottom of the body, instead of putting it inside the tag?

A

want the page to load first before we add/remove/etc the classes and elements

javascript runs after all the elements exist

172
Q

How do you get the text out of an HTML element?

using jQuery

A

using .text()

everything is a method

173
Q

How do you get the value out of an HTML input field?

A

val()

.value

174
Q

What’s the difference between .text() and .html()?

using jQuery

A

.text() = (similar to .textContent)

.html() = give full DOM tree

175
Q

What does .on() do?

using jQuery

A

handles all events

176
Q

What is event bubbling?

A

starts at the most specific node and flows outwards to the least specific one (Default type of event flow)

177
Q

What is the first argument the function setTimeout takes?

A

function definition

function callback (can be invoked later)

178
Q

If the second argument is not passed into the setTimeout function, what is the default value?

A

zero (executed immediately)

179
Q

What are some scenarios where setTimeout can be useful?

A

interacting with the user (seeing if the user is still there)

chat box on website

180
Q

Difference between setInterval and setTimeout

A

setInterval (function that gets called everytime you set)

setTimeout (function gets executed onc

181
Q

What argument does the clearInterval function take?

A

identifier of repeated action that you want to cancel NOT THE FUNCTION

182
Q

Which elements in a website are useful to create dynamically?

A

instagram posts
or
google search

183
Q

Why should you not create all elements dynamically?

A

The Structure from scratch

184
Q

What is a modal?

A

is a graphical control element subordinate to an application’s main window

185
Q

What are some use cases for modals?

A

it that they avoid the need to use of conventional window pop-ups or page reloads.

186
Q

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

A

max width

min width

187
Q

What is a method?

A

function attached to an object

188
Q

What does a method do?

A

takes what you ask and gives a response

189
Q

multiply: function (num1, num2)

A

there is an anonymous function definition with two parameters (num 1 and num2) being assigned to the property of multiply

190
Q

return num1 * num2

A

the variable num1 is being multiplied by variable num2 and the result of that expression is being returned to the function

191
Q

What is ‘this’ keyword?

A

refers to one object (usually the object in which the function operates)

192
Q

What does bind do?

What does bind do?

A

creates a new function that has ‘this’ keyword set to a provided value

193
Q

What is the difference between a function and an object literal?

A

object literal: contains properties with values

functions: performs a task

194
Q

What is Prototypal Inheritance?

A

objects inherit properties from another object

195
Q

What is the Prototypal Chain?

A

object.create()

it will create a new

196
Q

In the custom objects we created, I noticed that our prototype object has another __proto__ property, where did that come from?

A

when we created carInfoPrototype type using curly braces, it will inherit the __proto__ property

197
Q

Why does JavaScript have Prototypal Inheritance?

A

to save memory

198
Q

What does the new keyword do?

A

creates a new object

new is adding things onto an object for you

new keyword does this:

  • makes an empty object
  • sets the constructor of the object to another object
  • passed the newly created object as the this keyword context
  • returns this keyword if the function doesn’t return an objectcreates a new object

new is adding things onto an object for you

new keyword does this:

  • makes an empty object
  • sets the constructor of the object to another object
  • passed the newly created object as the this keyword context
  • returns this keyword if the function doesn’t return an object
199
Q

I could’ve added a method to the constructor function by assigning a method to a property on the this object. Why do we have to add it to the prototype property?

A

instead of car.prototype.overview(), i could’ve used car.overview()… why use prototype?

inheritance! using memory efficiency.

200
Q

car.prototype.overview = function() {

A

there is an anonymous function definition being assigned for the value of the overview property of the object within the prototype object of the car object

201
Q
var fiat = new Car(
'fiat',
'500',
'500kg',
200,
'white',
4
)
A

the car function is being called using the new keyword and the return of that function call is being returned to the variable fiat

202
Q

What is the first thing that happens in a class when it is instantiated with the new keyword?

A

calls the constructor function

203
Q

Since classes are technically functions as well. Can you name a difference between classes and functions?

A

classes do not hoist (they have to be declared first)

functions can hoist

204
Q

What is the basic idea of OOP?

A

we use objects to model real world things that we want to represent inside our programs, and/or provide a simple way to access functionality that would otherwise be hard or impossible to make use of

205
Q

class parent { }

A

class definition name parent

206
Q

What is the benefit of instantiating Classes within other classes?

A

making a class inside another class, you save the class on the parent class

207
Q

Why are parent - child relationships important in OOP?

A

avoid spaghetti code (keep everything in it’s own space)

easier to build on

208
Q

askForFood() { }

A

askForFood method being defined with no parameters

209
Q

Why did you have to bind this for the feedChild method in the Parent class?

A

you would not be able to get the data from the other source

if you do not bind this, then there is no tie to the child class

210
Q

Why is it important to assign callback methods to properties in the constructor?

A

functions are destroyed after constructor is done; save it as a property so that we can reference it in the future

211
Q

Why did the Maker class require all of the Parent class info?

A

It needs to have the values to respond to it

212
Q

Why did you have to bind this for the replenishFood method.

A

needs to be called inside of a specific object

213
Q

What decides the order in which JS files must be loaded?

A

The order you put js files

214
Q

What is JSON?

A

is a standard text-based format for representing structured data based on JavaScript object syntax.

215
Q

What are serialization and deserialization and why are they useful?

A
  1. Serialization is the process of turning an object in memory into a stream of bytes so you can do stuff like store it on disk or send it over the network.
  2. Deserialization is the reverse process: turning a stream of bytes into an object in memory.
216
Q

How to you serialize data into a JSON string using JavaScript?

A

JSON.stringify() method

217
Q

How do you deserialize a JSON string using JavaScript?

A

JSON.parse() method