JAVASCRIPT Flashcards

1
Q

What is the purpose of variables?

A

the purpose of variables is to not lose track of the variable in your code

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

How do you declare a variable?

A

with the var keyword

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

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

A

with the = opertor

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

What characters are allowed in variable names?

A

$, _,

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

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

A

if you have a variable with a capital S and lower case s they are different

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

What is the purpose of a string?

A

to have a number of letters to make up something

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

What is the purpose of a number?

A

the prupose of a number is to hold a numeric value.

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

What is the purpose of a boolean?

A

to determine true or false

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

What does the = operator mean in JavaScript?

A

it is the assignment operator

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

How do you update the value of a variable?

A

variable name = and then the value you want to give it

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

What is the difference between null and undefined?

A

null is done intentioanlly and undefined is not

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

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

A

so you know what data is being output and you can keep track of what you are logging

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

Give five examples of JavaScript primitives.

A

string, number, boolean, undefined, null, array object

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

What data type is returned by an arithmetic operation?

A

numeric data type

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

What is string concatenation?

A

the joining of one strring and another string to make a whole string

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

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

A

it allows us to add strings or numerical values together

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

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

A

boolean

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

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

A

adds and assigns new value to current value

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

What are objects used for?

A

a data type that allows you to store data in indivisual keys

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

What are object properties?

A

indivisual keys that hold a value

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

Describe object literal notation.

A
var hello = {
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How do you remove a property from an object?

A

delete object.property

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

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

A

. notation and bracket notation

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

What are arrays used for?

A

arrays are used to store multiple values of data kind of like a shopping list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Describe array literal notation.
[ ]
26
How are arrays different from "plain" objects?
array hold and index and object do not
27
What number represents the first index of an array?
0
28
What is the length property of an array?
the length property stores values and lets a use know the length of an an array
29
How do you calculate the last index of an array?
subtract 1 from the length of the array
30
What is a function in JavaScript?
a set of statments that perform tasks to calculate a value
31
Describe the parts of a function definition.
function defention, keyword, parameter lsit
32
Describe the parts of a function call.
function name ()
33
When comparing them side-by-side, what are the differences between a function call and a function definition?
``` function call uses function name with () and any argument defention has a function keyword and code block() ```
34
What is the difference between a parameter and an argument?
a paremeter holds a place so that you can add whatever argument you want later.
35
Why are function parameters useful?
Function parameters are useful because they act as placeholders for data.
36
What two effects does a return statement have on the behavior of a function?
a return statement stops the code once the return statement has been executed.
37
Why do we log things to the console?
to see what the output is that we are getting
38
What is a method?
a function which is a property of an object
39
How is a method different from any other function?
A method, like a function, is a set of instructions that perform a task. The difference is that a method is associated with an object, while a function is not.
40
How do you remove the last element from an array?
.pop()
41
How do you round a number down to the nearest integer?
Math.floor()
42
How do you generate a random number?
Math.random()
43
How do you delete an element from an array?
.splice( )
44
How do you append an element to an array?
.push( )
45
How do you break a string up into an array?
.split( )
46
Do string methods change the original string? How would you check if you weren't sure?
All string methods return a new string. They don't modify the original string. F
47
Roughly how many string methods are there according to the MDN Web docs?
80-85
48
Is the return value of a function or method useful in every situation?
no
49
Roughly how many array methods are there according to the MDN Web docs?
40-50
50
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDN
51
Give 6 examples of comparison operators.
``` > < >= <= === ! ```
52
What data type do comparison expressions evaluate to?
true or false
53
What is the purpose of an if statement?
54
Is else required in order to use an if statement?
No
55
Describe the syntax (structure) of an if statement.
if( ){ | }
56
What are the three logical operators?
logical and && logical or || logical not !
57
How do you compare two different expressions in the same condition?
logical and logical or operator
58
What is the purpose of a loop?
the purpose of a loop is to run something several times until a condition is met
59
What is the purpose of a condition expression in a loop?
60
What does "iteration" mean in the context of loops?
it is the repetition of a process
61
When does the condition expression of a while loop get evaluated?
second after the initializtion
62
When does the initialization expression of a for loop get evaluated?
when the loop starts.
63
When does the condition expression of a for loop get evaluated?
64
When does the final expression of a for loop get evaluated?
after the code block runs and before the condition runs again
65
Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?
break
66
What does the ++ increment operator do?
the increment operator increments a value
67
How do you iterate through the keys of an object?
The Object. keys() method was introduced in ES6. It takes the object that you want to iterate over as an argument and returns an array containing all properties names (or keys)
68
Why do we log things to the console?
we log things to the console to see what the output is
69
What is a "model"?
a model is a piece that is a replica of something else
70
Which "document" is being referred to in the phrase Document Object Model?
HTML document
71
What is the word "object" referring to in the phrase Document Object Model?
the nodes
72
What is a DOM Tree?
Document object model that stores parent elements and their children elements
73
Give two examples of document methods that retrieve a single element from the DOM.
document. querySelector() | document. getElementById()
74
Give one example of a document method that retrieves multiple elements from the DOM at once.
document.querySelectorAll()
75
Why might you want to assign the return value of a DOM query to a variable?
So that you can document it again
76
What console method allows you to inspect the properties of a DOM element object?
the dir. direcotry method
77
Why would a tag need to be placed at the bottom of the HTML content instead of at the top?
So that we can let the document know that we are going to include javascript
78
What does document.querySelector() take as its argument and what does it return?
css selector and returns the first element with that selector
79
What does document.querySelectorAll() take as its argument and what does it return?
csss selector and it returns all elements that have the id selectors
80
What is the className property of element objects?
The className property of the Element interface gets and sets the value of the class attribute of the specified element.
81
How do you update the CSS class attribute of an element using JavaScript?
setAttribute()
82
What is the textContent property of element objects?
The textContent property sets or returns the text content of the specified node, and all its descendants.
83
How do you update the text within an element using JavaScript?
using the document.querySelector(' ).textcontent
84
Is the event parameter of an event listener callback always useful?
no it is not
85
Would this assignment be simpler or more complicated if we didn't use a variable to keep track of the number of clicks?
more complicated
86
Why is storing information about a program in variables better than only storing it in the DOM?
87
What does the transform property do?
the transform property lets you move the element around in differne ways
88
Give four examples of CSS transform functions.
89
What event is fired when a user places their cursor in a form control?
the focus event
90
What event is fired when a user's cursor leaves a form control?
the blur event
91
What event is fired as a user changes the value of a form control?
the input event
92
What event is fired when a user clicks the "submit" button within a ?
submit event
93
What does the event.preventDefault() method do?
it stops the default method from happening
94
What does submitting a form without event.preventDefault() do?
The preventDefault() method cancels the event if it is cancelable, meaning that the default action that belongs to the event will not occur
95
What property of a form element object contains all of the form's controls.
form
96
What property of a form control object gets and sets its value?
.value gets and sets property of a form control
97
What is one risk of writing a lot of code without checking to see if it works so far?
You can not see where you messed up and it is harder to find where you made a mistake
98
What is an advantage of having your console open when writing a JavaScript program?
You can see where there is an error as it happens
99
Give two examples of media features that you can query in an @media rule.
min-width max-width
100
Which HTML meta tag is used in mobile-responsive web pages?
viewport
101
Does the document.createElement() method insert a new element into the page?
no it does not
102
How do you add an element as a child to another element?
with the appendChild() method
103
What do you pass as the arguments to the element.setAttribute() method?
we pass the classname or attributes we want to include on that element
104
What steps do you need to take in order to insert a new element into the page?
document.createElementById('div")
105
What is the textContent property of an element object for?
we can use it to set and change the text of an element from the DOM
106
Name two ways to set the class attribute of a DOM element.
setAttribute and .className
107
What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?
we ca go back and re use the data for other situations
108
The transition property is shorthand for which four CSS properties?
transition-property transition-duration transition-timing-function transition-delay
109
What is the event.target?
The event.target property can be used in order to implement event delegation.
110
Why is it possible to listen for events on one element that actually happen its descendent elements?
Event delegation
111
What DOM element property tells you what type of element it is?
tagName
112
What does the element.closest() method take as its argument and what does it return?
The closest() method traverses the Element and its parents (heading toward the document root) until it finds a node that matches the provided selector string. Will return itself or the matching ancestor.
113
How can you remove an element from the DOM?
you can use the removechild() method
114
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?
you would add an event listener to the parent object and it would apply to its children
115
What kind of inheritance does the javascript programming language use?
prototypal inheritance
116
What is a prototype in Javascript?
prototype is an object that is associated with every functions and objects by default //object that other objects are allowed to build upon//
117
How is it possible to call methods on strings, arrays, and numbers event though those methods don't actually exist on objects, arrays, and numbers?
by using methods in the prototype object
118
If an object does not have its own property or method by a given key, where does javascript look for it ?
prototype. if it cannot find that property it goes to what it was built upon
119
What is this in JavaScript?
an object.
120
What does it mean to say that this is an "implicit parameter"?
it is available in a function code block even though it was never defined or declared
121
When is the value of this determined in a function; call time or definition time? ``` var character = { firstName: 'Mario', greet: function () { var message = 'It\'s-a-me, ' + this.firstName + '!'; console.log(message); } }; ```
Call time
122
When is the value of this determined in a function; call time or definition time?
call time
123
Given the above character object, what is the result of the following code snippet? Why? character.greet();
function it is me a mario
124
``` Given the above character object, what is the result of the following code snippet? Why? var hello = character.greet; hello() ```
the function its. a me mario becaue it is calling the function and that function is pointing to the message
125
How can you tell what the value of this is for a particular function or method call?
you have to have the method being called | the value to the left of the dot determines what it is
126
What does the new operator do?
The new keyword does the following things: - Creates a blank, plain JavaScript object. - Adds a property to the new object (__proto__) that links to the constructor function's prototype object - -Binds the newly created object instance as the this context (i.e. all references to this in the constructor function now refer to the object created in the first step). - Returns this if the function doesn't return an object.
127
What property of JavaScript functions can store shared behavior for instances created with new?
prototype property
128
What does the instanceof operator do?
instanceof is a binary operator used to test if an object is of a given type.
129
What is a "callback" function?
a fucntion being passed around as a value
130
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?
setTImeout()
131
How can you set up a function to be called repeatedly without using a loop?
you can use the set interval methd
132
What is the default time delay if you omit the delay parameter from setTimeout() or setInterval()?
0 milliseonds
133
What do setTimeout() and setInterval() return?
numeric non interval value | numeric value is id for that interval
134
what is a client?
piece of hardware or software that accesses a servie made availabe by a server
135
What does the sort() method do?
The Array.sort() method sorts the elements of an array.
136
Reversing an array using which method?
he Array.reverse() method reverses the order.
137
Splice() method and its parameters
splice(start) splice(start, deleteCount) splice(start, deleteCount, item1) splice(start, deleteCount, item1, item2, itemN)
138
What does the setTimeOut() function do and how many times does it run
The setTimeout() function executes a code block after a specified amount of time (in milliseconds) and is only executed once.
139
endsWith() method
check to see iif a string ends with a specific ending
140
algorithm challenges
``` function confirmEnding(str, target) { return str.slice(str.length - target.length) === target } ``` confirmEnding("Bastian", "n"); ``` mutation algorithm to see if the first element has all letters in the second as well: function mutation(arr) { let test = arr[1].toLowerCase(); let target = arr[0].toLowerCase(); for(var i = 0; i < test.length; i++){ if(target.indexOf(test[i]) < 0){ return false } } return true } ``` mutation(["hello", "hey"]);
141
what does the slice methoid take as its pareemers
string.slice(start, end)
142
Matching single Chracters not specified using regular expressions
use the up carrot for chracters you do not want to match etc. /[^aeiou]/gi
143
ternary operator syntax
condition ? exprIfTrue : exprIfFalse
144
hasOwnProperty() method
check if an object has a specific property
145
Object.keys()
This will return the properties in the object it receives as an argument
146
Object.keys()
This will return the properties in the object it receives as an argument
147
spinal tap algrotihm using regex
``` function spinalCase(str) { var regex = /\s+|_+/g; ``` str= str.replace(/([a-z])([A-Z])/g, '$1 $2') return str.replace(regex, "-").toLowerCase(); } spinalCase('This Is Spinal Tap');
148
What is the difference between an ordered list and an unordered list in HTML?
An unorderd list is not numbers and an ordered List is numbered
149
Is an HTML list a block element or an inline element?
An HTML list is a block element
150
The Math.max() function returns the largest of the zero or more numbers given as input parameters, or NaN if any parameter isn't a number and can't be converted into one.
151
The Math.random() function returns a floating-point, pseudo-random number in the range 0 to less than 1 (inclusive of 0, but not 1) with approximately uniform distribution over that range — which you can then scale to your desired range. The implementation selects the initial seed to the random number generation algorithm; it cannot be chosen or reset by the user.
152
The splice() method changes the contents of an array by removing or replacing existing elements and/or adding new elements in place. To access part of an array without modifying it, see slice().
153
The split() method divides a String into an ordered list of substrings, puts these substrings into an array, and returns the array. The division is done by searching for a pattern; where the pattern is provided as the first parameter in the method's call.
154
If you want to check a method then look at MDN Documentation for all methods
155
for ([initialization]; [condition]; [final-expression]) | statement
156
DOM QUERYING QUIZ
157
Why do we log things to the console?
So we know what is being output in the console
158
What is a "model"?
a model is a piece that is a replica of something else
159
Which "document" is being referred to in the phrase Document Object Model?
HTML DOCUMENT
160
What is the word "object" referring to in the phrase Document Object Model?
the nodes
161
What is a DOM Tree?
Document object model that stores parent elements and their children elements
162
Give two examples of document methods that retrieve a single element from the DOM.
document.QuerySelector() | and document.getElementById()
163
Give one example of a document method that retrieves multiple elements from the DOM at once.
document.querySelectorAll()
164
Why might you want to assign the return value of a DOM query to a variable?
So you can use it in your code later
165
What console method allows you to inspect the properties of a DOM element object?
the dir. direcotry method
166
Why would a tag need to be placed at the bottom of the HTML content instead of at the top?
because javascript is read last in the html document
167
What does document.querySelector() take as its argument and what does it return?
css selector and returns the first element with that selector
168
What does document.querySelectorAll() take as its argument and what does it return?
csss selector and it returns all elements that have the id selectors
169
DOM EVENTS QUIZ
170
Why do we log things to the console?
So we know what the output is
171
What is the purpose of events and event handling?
to do a specific task when the user interacts within elements on the page an event is some occurence that happens onn the page and handling is the steps we take
172
Are all possible parameters required to use a JavaScript method or function?
no because we do not alway use parameers
173
What method of element objects lets you set up a function to be called when a specific type of event occurs?
event listener
174
What is a callback function?
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.
175
What object is passed into an event listener callback when the event fires?
the event object
176
What is the event.target? If you weren't sure, how would you check? Where could you get more information about it?
The read-only target property of the Event interface is a reference to the object onto which the event was dispatched. It is different from Event.currentTarget when the event handler is called during the bubbling or capturing phase of the event. You would check in the console to see what the target is MDN
177
What is the difference between these two snippets of code?
one is calling the function within the argumebt abd tghe other is not
178
What is the className property of element objects?
The className property The className property of the Element interface gets and sets the value of the class attribute of the specified element.
179
How do you update the CSS class attribute of an element using JavaScript?
You update the class with the className property
180
What is the textContent property of element objects?
the text content property sets the new text to the element it was assigned to it is also a getter and setter
181
How do you update the text within an element using JavaScript?
textContent property
182
Is the event parameter of an event listener callback always useful?
no it is not
183
Would this assignment be simpler or more complicated if we didn't use a variable to keep track of the number of clicks?
it would be more complicated because we would not know how many times the user clicked and therefore we would be lost
184
Why is storing information about a program in variables better than only storing it in the DOM?
because we can always use that variable for something else if we need to change or update values
185
What does the transform property do?
The transform CSS property lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS visual formatting model.
186
give four examples of tranforms functions
Skale, rotate, skew, translate
187
The css transiitons property is shorthand for
The transition CSS property is a shorthand property for transition-property, transition-duration, transition-timing-function, and transition-delay.
188
What event is fired when a user places their cursor in a form control?
focus event
189
What event is fired when a user's cursor leaves a form control?
blur event
190
What event is fired as a user changes the value of a form control?
input event
191
What event is fired when a user clicks the "submit" button within a form?
submit event
192
What does the event.preventDefault() method do?
it stops the default method from happening
193
What does submitting a form without event.preventDefault() do?
The preventDefault() method cancels the event if it is cancelable, meaning that the default action that belongs to the event will not occur
194
What property of a form element object contains all of the form's controls.
elements property
195
What property of a form control object gets and sets its value?
.value gets and sets property of a form control
196
What is one risk of writing a lot of code without checking to see if it works so far?
You will not see where the error is and it willl be harder to adjust your code based on the error
197
What is an advantage of having your console open when writing a JavaScript program?
You can see if there are any errors right away before you proceed with writing more code
198
Does the document.createElement() method insert a new element into the page?
no it doesnt
199
How do you add an element as a child to another element?
appendChild() method
200
What do you pass as the arguments to the element.setAttribute() method?
name and value
201
What steps do you need to take in order to insert a new element into the page?
create the element give it text content attributes if its needed append somewhere
202
What is the textContent property of an element object for?
it gets and sets the textContent of an element
203
Name two ways to set the class attribute of a DOM element.
set Attribute and className and classList
204
What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?
we ca go back and re use the data for other situations can find errors easily lets your code be easier to navigate
205
Give two examples of media features that you can query in an @media rule.
min width and max width
206
Which HTML meta tag is used in mobile-responsive web pages?
viewport
207
What is event.target?
The read-only target property of the Event interface is a reference to the object onto which the event was dispatched. The element that was interacted with
208
Why is it possible to listen for events on one element that actually happen its descendent elements?
because bubbling which will bubble up to the parent event delegation
209
What DOM element property tells you what type of element it is?
event.target.tagName
210
What does the element.closest() method take as its argument and what does it return?
selectors A string of valid CSS selector to match the Element and its ancestors against. Return value The closest ancestor Element or itself, which matches the selectors. If there are no such element, null.
211
How can you remove an element from the DOM?
remove method
212
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?
add it to the parent element | The parent will catch anything that bubbles up
213
What is event.target
The element that was interacted with
214
What is the affect of setting an element to display: none?
the affected element will dissapear removes it from document flow
215
What does the element.matches() method take as an argument and what does it return?
takes a css selector and returns a boolean to determine if it matches that selector
216
How can you retrieve the value of an element's attribute?
getAttribute method
217
At what steps of the solution would it be helpful to log things to the console?
once you start writing the function and adding a for loop also to check if event,target matches the right event
218
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?
you would have a lot of event listeners
219
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 lot of if else statements | and or conditional blocks
220
What is a breakpoint in responsive Web design?
The points at which a media query is introduced are known as breakpoints.
221
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?
The advantage would be that not all screens are the same size so if you have a widtch set to 50% then it would be 50% of that screen rather than having a fixed pixel and not all screens have the same pixel size
222
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?
This is due to the order of which they were put in css cascade source order
223
What is JSON?
JSON is a text-based data format following JavaScript object syntax
224
What are serialization and deserialization?
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. Deserialization is the reverse process: turning a stream of bytes into an object in memory.
225
Why are serialization and deserialization useful?
Allows you to send data and convert that data into a series of bytes when you receive it
226
How do you serialize a data structure into a JSON string using JavaScript?
JSON.stringify
227
How do you deserialize a JSON string into a data structure using JavaScript?
JSON.parse
228
How to convert a array or object to a string
JSON.stringify(value)
229
How do you store data in localStorage?
localStorage.setItem method
230
How do you retrieve data from localStorage?
getItem method
231
What data type can localStorage save in the browser?
JSON strings
232
When does the 'beforeunload' event fire on the window object?
When the window and document are about to be unloaded
233
What is a method? How can you tell the difference between a method definition and a method call? Describe method definition syntax (structure). Describe method call syntax (structure). How is a method different from any other function? What is the defining characteristic of Object-Oriented Programming? What are the four "principles" of Object-Oriented Programming? What is "abstraction"? What does API stand for? What is the purpose of an API
1. A method is a function which is a property of an object. 2. A method definition while a method call is attached to an object 3. method name and parenthesis () 4.type the method name attached to its objects 5 A method is attached to an object while any other function is not 6. Objects can contain both data (as properties) and behavior (as methods). 7. Abstraction Encapsulation Inheritance Polymorphism 8 being able to work with (possibly) complex things in simple ways. 9 application programming interface (API) 10.is to give programmers a way to interact with a system in a simplified, consistent fashion: aka, an abstraction.
234
What is this in javascript?
this is an implicit parameter of all JavaScript functions.
235
What does it mean to say that this is an "implicit parameter"?
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
236
When is the value of this determined in a function; call time or definition time?
when the function is called
237
What does this refer to in this code snippet?
the character object
238
Given the above character object, what is the result of the following code snippet? Why? character.greet();
Its a me mario
239
``` Given the above character object, what is the result of the following code snippet? Why? var hello = character.greet; hello(); ```
its a me undefined because there is no character object assigned to it
240
How can you tell what the value of this will be for a particular function or method definition?
if there is no value to the left of the dot when the function is called, then by default, this will be the global window object.
241
How can you tell what the value of this is for a particular function or method call?
if you cannot see the function being called, then you do not know what the value of this will be.
242
Object.setPrototypeOf(obj, prototype)
Object.setPrototypeOf(obj, prototype)
243
What kind of inheritance does the JavaScript programming language use?
prototypal based inheritence
244
What is a prototype in JavaScript?
an original model on which something is patterned
245
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?
protoype
246
If an object does not have it's own property or method by a given key, where does JavaScript look for it?
prototype chain
247
What does the new operator do?
The new operator lets developers create an instance of a user-defined object type or of one of the built-in object types that has a constructor function. 1. Creates a blank, plain JavaScript object. For convenience, let's call it newInstance. 2. Points newInstance's [[Prototype]] to the constructor function's prototype property. 3. Executes the constructor function with the given arguments, binding newInstance as the this context (i.e. all references to this in the constructor function now refer to newInstance). 4. If the constructor function returns a non-primitive, this return value becomes the result of the whole new expression. Otherwise, if the constructor function doesn't return anything or returns a primitive, newInstance is returned instead. (Normally constructors don't return a value, but they can choose to do so to override the normal object creation process.)
248
What property of JavaScript functions can store shared behavior for instances created with new?
prototype property
249
What does the instanceof operator do?
The instanceof operator tests to see if the prototype property of a constructor appears anywhere in the prototype chain of an object. The return value is a boolean value.
250
What is a "callback" function?
a function that is passed as an argument to another function
251
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?
setTimeout()
252
How can you set up a function to be called repeatedly without using a loop?
setInterval()
253
What is the default time delay if you omit the delay parameter from setTimeout() or setInterval()?
Defaults to 0 if not specified
254
What do setTimeout() and setInterval() return?
SetTimeout() returns. The returned timeoutID is a positive integer value which identifies the timer created by the call to setTimeout(). setInterval returns The returned intervalID is a numeric, non-zero value which identifies the timer created by the call to setInterval()
255
What is a client?
client is a piece of computer hardware or software that accesses a service made available by a server as part of the client–server model of computer networks. THe one who is making the request
256
What is a server?
a server is a piece of computer hardware or software (computer program) that provides functionality for other programs or devices, called "clients" Server is a software driven thing
257
Which HTTP method does a browser issue to a web server when you visit a URL?
get request
258
What three things are on the start-line of an HTTP response message?
protocol version status code status text
259
What three things are on the start-line of an HTTP request message?
1. An HTTP method, a verb (like GET, PUT or POST) or a noun (like HEAD or OPTIONS), that describes the action to be performed. 2. The request target, usually a URL, or the absolute path of the protocol, port, and domain are usually characterized by the request context. 3. The HTTP version, which defines the structure of the remaining message, acting as an indicator of the expected version to use for the response.
260
What are HTTP headers?
An HTTP header is a field of an HTTP request or response that passes additional context and metadata about the request or response.```` HTTP Headers are information about the request being made.
261
Where would you go if you wanted to learn more about a specific HTTP Header?
MDN
262
Is a body required for a valid HTTP request or response message?
no
263
What is AJAX
a programming practice of building complex, dynamic webpages using a technology known as XMLHttpRequest. Ajax allows you to update parts of the DOM of an HTML page without the need for a full page refresh. Ajax also lets you work asynchronously, meaning your code continues to run while the targeted part of your web page is trying to reload (compared to synchronously, which blocks your code from running until that part of your page is done reloading).
264
What does the AJAX acronym stand for?
Asynchronous JavaScript And XML
265
Which object is built into the browser for making HTTP requests in JavaScript?
XMLHttpRequest
266
What event is fired by XMLHttpRequest objects when they are finished loading the data from the server?
The load event is fired
267
Bonus Question: An XMLHttpRequest object has an addEventListener() method just like DOM elements. How is it possible that they both share this functionality?
They Have a shared prototype object