HTML Flashcards

1
Q

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

A

Head

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

Where do you put visible content about the HTML document?

A

Body

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

Where do the and tags go in a valid HTML document?

A

between closing and opening html tag element

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

What is the purpose of a declaration?

A

let us know that this is an html document

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

give 5 examples of html element tags

A

head tag, body tag, p tag, h1 tag, title tag

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 more information for the html element.

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

Give an example of an HTML entity (escape character).

A

® = registered trademark

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

block starts on new line and takes up the whole width.

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

inline continues and takes as much space as needed.

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

100% width and the height is based on the html element content.

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

width is based on content as well as height

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 list are numbers and unordered are bullets

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

block

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

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

A

../ to indicate the folder above the currentone, then follow it with the file name.

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

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

A

Name of the child folder followed by a forward slash then the file name

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

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

A

../../ indicate that you want to go up two folders rather than one follow it up with the file name.

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 the same directory?

A

Just use the file name.

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

What is the purpose of an HTML form element?

A

To collect information from visitors using different types of form control.

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

Give five examples of form control elements.

A

Text input, radio, button, password input, text area,

Checkboxes, drop down boxes, submit buttons.

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

Give three examples of type attributes for HTML elements.

A

button, radio

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

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

A

INLINE

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

name 3 different types of values you can use to specify colors in css.

A

HEX, NAME AND RGB.

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

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

A

CSS RULE SET:
SELECTOR {DECLARATION BLOCK
PROPERTY AND VALUE}

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

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

A

using a period followed by the name

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

In CSS how do you select elements by their type

A

just the name of the element

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

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

A

using “hashtag” # followed by the name.

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

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

A

RGB , HEX AND COLOR VALUE NAME

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

What CSS properties make up the box model?

A

It consists of: margins, borders, padding, and the actual content.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
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
30
Q

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

A

PADDING : BORDER-SPACING

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

What is a pseudo-class?

A

A CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s). For example, :hover can be used to change a button’s color when the user’s pointer hovers over it.

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

What are CSS pseudo-classes useful for?

A

it can be used to: Style an element when a user mouses over it. Style visited and unvisited links differently.

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

Name at least two units of type size in CSS.

A

REM, PIXEL

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

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

A

FONT-FAMILY

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

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

A

ROW

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q
  • What is theevent.target?
A
  • The element that was targeted by the user.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q
  • What is the affect of setting an element todisplay: none?
A
  • it prevents the html from rendering.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q
  • What does theelement.matches()method take as an argument and what does it return?
A
  • argument: css selector string and it returns a boolean if it is a match or not. true or false.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q
  • How can you retrieve the value of an element’s attribute?
A
  • getAttribute()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q
  • At what steps of the solution would it be helpful to log things to the console?
A
  • -every step you’re unsure of not getting results ; everywhere you log it.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
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 have to manually set an event listener for each tab. -
  • If you didn’t use a loop to conditionally show or hide the views in the
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
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
  • manually find each element and unset the class.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q
  • What is abreakpointin responsive Web design?
A
  • where the content on the page responds depending on what the media feature width was set at . Place where the media query.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q
  • What is the advantage of using a percentage (e.g.50%)widthinstead of a fixed (e.g.px)widthfor a “column” class in a responsive layout?
A

percentage will correlate with the device width. whereas 300 pixels is a set amount correlate with the container viewport.

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

f you introduce CSS rules for a smallermin-widthafterthe styles for a largermin-widthin your style sheet, the CSS rules for thesmallermin-widthwill “win”. Why is that?

A
  • source order : cascade example. CSS the source order is important. Media query should be on the bottom.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q
  • What is JSON?
A

JSONis a text-based data format following JavaScript object syntax the data is passed in strings.
- object /array rendered to string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q
  • What are serialization and deserialization?
A
  • serialization is turning object/array to string “stings are characters of byte”
  • deserialization is turning strings into object/array.
  • send and receive data possible.
    Simply speakingSerializationis a process of converting an Object into stream of bytes so that it can be transferred over a network or stored in a persistent storage.
    Deserialization is the exact opposite - Fetch a stream of bytes from network or persistence storage and convert it back to the Objectwith the same state.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q
  • Why are serialization and deserialization useful?
A
  • might be too large, and we can’t transmit data based on memory data
  • serialization is easy to transfer.
  • deserialization: is easy to access.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q
  • How do you serialize a data structure into a JSON string using JavaScript?
A
  • using JSON.stringify(); method.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q
  • How do you deserialize a JSON string into a data structure using JavaScript?
A
  • using JSON.parse(); method.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

reason for JSON

A

reason why we have JSON so we have a format where we can transmit data.
takeaway: Strings can be used to store data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q
  • How to you store data inlocalStorage?
A
  • go to applications then local storage.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q
  • What data type canlocalStoragesave in the browser?
A
  • key and values
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q
  • When does the’beforeunload’event fire on thewindowobject?
A
  • -before you unload it will notify you.
    • right before you leave the website. Notify with a pop up window.
    • before the tab unloads.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q
  • What is amethod?
A

methods areactions that can be performed on objects. A JavaScript method is a property containing a function definition. Methods are functions stored as object properties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q
  • How can you tell the difference between a methoddefinitionand a methodcall?
A
  • method call you pass in an argument.
  • function inside a method’s name and method call is you’re
  • parenthesis .
    method definition will always include a code block with the function keyword.
    method calls : predefined function. starting with the object.method(‘call’);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q
  • Describe methoddefinitionsyntax (structure).
A
  • property : function assigning to a property
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q
  • Describe methodcallsyntax (structure).
A

object.property().

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q
  • How is a method different from any other function?
A

method are functions stored as object properties

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
Q
  • What is thedefining characteristicof Object-Oriented Programming?
A

Object-oriented methodology relies on three characteristics that define object-oriented languages:encapsulation, polymorphism, and inheritance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
61
Q
  • What are the four “principles” of Object-Oriented Programming?
A
  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
62
Q
  • What is “abstraction”?
A
  • Taking something complex and making it simple for example light switch. we just turned on and off, but there’s more complex things behind that light switch.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
Q
  • What does API stand for?
A

application programing interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
64
Q
  • What is the purpose of an API?
A
  • someone created a set of tools for you to use. “communication between softwares” interaction between multiple softwares.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
65
Q
  • What isthisin JavaScript?
A
  • object The JavaScript this keyword refersto the object it belongs to.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
66
Q
  • What does it mean to say thatthisis an “implicit parameter”?
A

it’s animplicitparameter, meaning that it is available in a function’s code block even though it was never included in the function’s parameter list or declared withvar.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
67
Q
  • Whenis the value ofthisdetermined in a function;call timeordefinition time?
A

call time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
68
Q
  • What doesthisrefer to in the following code snippet?
  • var character = {
  • firstName: ‘Mario’,
  • greet: function () {
  • var message = ‘It's-a-me, ‘ + this.firstName + ‘!’;
  • console.log(message);
  • }
  • };
A
  • “undefined : this.firstName was not called. the value is determined at call time. “
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
69
Q
  • Given the abovecharacterobject, what is the result of the following code snippet? Why?character.greet();
A

It’s a me “mario!”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
70
Q
  • Given the abovecharacterobject, what is the result of the following code snippet? Why?var hello = character.greet;
  • hello();
A

It’s a me , undefined! - the greet property was not called with the function.?

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

How can you tell what the value ofthiswill be for a particular function or methoddefinition?

A

-there is no way to know what the value yet .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
72
Q
  • How can you tell what the value ofthisis for a particular function or methodcall?
A
  • the object left to the left of the dot.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
73
Q
  • What kind of inheritance does the JavaScript programming language use?
A

-prototype-based inheritance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
74
Q
  • What is a prototype in JavaScript?
A
  • a prototype in javascript is a template object that allows objects to inherits methods and properties from.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
75
Q
  • How is it possible to call methods on strings, arrays, and numbers even though those methods don’t actually exist on objects, arrays, and numbers?
A

prototype object : inheritance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
76
Q
  • If an object does not have it’s own property or method by a given key, where does JavaScript look for it?
A

look into the parent object : Prototype object.

a prototype can be under another prototype.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
77
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
78
Q

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

A

focus

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

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

A

blur

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

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

A

input

81
Q

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

A

Prevent form submission

82
Q

What does the event.preventDefault() method do?

A
  • prevent default :
83
Q

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

A

It’ll keep running

84
Q

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

A

HTMLFormElement property.

85
Q

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

A

Is the one for form control. Value property.

86
Q

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

A

The code might’ve broken earlier on.

87
Q

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

A

Check the code in real time.

88
Q

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

A

no, it’s not part of the Dom tree until it is appended.

89
Q

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

A

parent.appendchild(child)

90
Q

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

A

Element.setAttribute(name, value);

91
Q

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

A

Create the element with createElement()
Create the textNode with createTextNode() ←-optional
Appendchild(); specify which element you want this node added to
parent appendchild child

92
Q

What is the textContent property of an element object for?

A

represents the text content of the node

93
Q

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

A

Set attribute method
Class Name method.
Class list : add(); remove();

94
Q

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

A
  • Reuse content; in multiple applications.
    • update the content .
    • return the DOM TREE. at the end.
    • take the most external and then return it .
95
Q

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

A

@media (max-width: 12450px) { … }
@media (hover: hover) { … }
Min width & max width.

96
Q

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

Meta - viewport .

A
97
Q

What is the event.target?

A

the element that was touched/targeted

98
Q

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

A

parent and children

99
Q

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

A

typeOF

100
Q

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

A

the closest element

101
Q

How can you remove an element from the DOM?

A

remove()

102
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

reuse the same function

103
Q

What is the className property of element objects?

A
  • Property that allows you to get the class attribute of the element or set it.
  • the value of the class attribute.
104
Q

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

A

Element.classname = with the new class.

105
Q

What is the textContent property of element objects?

A

The text content within the node and their child.

106
Q

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

A

Node.textContent = ‘string’.

Dom object .textContent =

107
Q

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

A

No.

108
Q

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

A

Won’t be able to track the number of clicks.

Hard to keep track. You want it to keep

109
Q

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

A

easy access

110
Q

What does the transform property do?

A

CSS property lets you rotate, scale, skew, or translate an element.

111
Q

Give four examples of CSS transform functions.

A

matrix()
Describes a homogeneous 2D transformation matrix.
matrix3d()
Describes a 3D transformation as a 4×4 homogeneous matrix.
Rotation
rotate()
Rotates an element around a fixed point on the 2D plane.
rotate3d()
Rotates an element around a fixed axis in 3D space.
rotateX()
Rotates an element around the horizontal axis.
rotateY()
Rotates an element around the vertical axis.
rotateZ()
Rotates an element around the z-axis.
*rotate, translate, matrix, skew ;

112
Q

Why do we log things to the console?

A

to check your code

113
Q

What is a “model”?

A

Our code is just code. When the webpage loads our code that is the model. The physical representation of our code.

114
Q

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

A

Document node is the representation of the entire page.

HTML is the document.

115
Q

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

A

The nodes. “Each node is an object with methods and properties.
In the HTML DOM, the Element object represents an HTML element, like P, DIV, A, TABLE, or any other HTML element.
“Javascript” it’s an object modeling the javascript model.

116
Q

What is a DOM Tree?

A

What is a DOM Tree?
How your code is sorted out. With the document node always on top. Document node is the parent with every other node a descendent of the document node.
Collection of HTML elements that are connected with each other like a family tree.

117
Q

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

A
  • getElementByID();

- querySelector();

118
Q

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

A

getElementByClassName();
getElementByTagName();
querySelectorAll();

119
Q

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

A

Method that finds elements in the DOM tree are called DOM queries.
When you need to work with an element more than once you should use a variable to store the result of that query.
“For multiple use you can reuse it”

120
Q

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

A

The method console.dir();

121
Q

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

A

Html reads top to bottom.

122
Q

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

A

querySelector(‘css selector’)

123
Q

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

A

querySelectorAll
Will take all of the querySelectorAll css selector: even if they have multiple css selector.
Uses the css selector syntax to select one or more elements and return all of those that matches.

124
Q

Why do we log things to the console?

A

to check our code

125
Q

What is the purpose of events and event handling?

A

User interaction. User clicks a function happens. The code responds to the user.

126
Q

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

A

no

127
Q

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

A

addEventListener() method

128
Q

What is a callback function?

A

A callback function is a function passed into another function as an argument,

129
Q

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

A

Event object -

130
Q

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

A

An object referencing where the event started and occurs.

131
Q

What is the difference between these two snippets of code?

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

A

First one includes the call back : legitimate eventlistener
Second one includes
-function call : the return of the function call.
It got called before it was
Never call an event handler.
Need one for the event “example” - click
& one return it

132
Q

What are the four components of “the Cascade”.

A

Order it is in “where it is”, how specific it is, “how important it is”
Source orders, inheritance, specificity,

133
Q

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

A

Where you put the selector in the style sheet effects what property is applied

“Preference for css styles is to use the source order” laying out the css.

134
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

-direct children inherit the parent css.
“Relating to fonts: text.
Font family & color property.”
Positioning is not inheritance.

135
Q

List the three selector types in order of increasing specificity.

A

Type selector: the element
Class selector
Id selector

136
Q

Why is using !important considered bad practice?

A

It breaks the cascading style and is hard for debugging.

137
Q

why do we log things to the console?

A

To check your work if it is working correctly.

138
Q

What is a method?

A

JavaScript methods are actions that can be performed on objects.
A JavaScript method is a property containing a function definition.

139
Q

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.

140
Q

How do you remove the last element from an array?

A

The pop() method

141
Q

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

A

floor() methd

142
Q

How do you generate a random number?

A

random()

143
Q

How do you delete an element from an array?

A

Splice () :

144
Q

How do you append an element to an array?

A

Push method ();

145
Q

How do you break a string up into an array?

A

Split () method

146
Q

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

A

No: , console log

147
Q

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

A

30ish.

148
Q

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

A

no

149
Q

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

A

35

150
Q

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

A

mdn

151
Q

Give 6 examples of comparison operators.

A
​​Less than () — returns true if the value on the left is greater than the value on the right, otherwise it returns false.
Less than or equal to (<=) — returns true if the value on the left is less than or equal to the value on the right, otherwise it returns false.
Greater than or equal to (>=) — returns true if the value on the left is greater than or equal to the value on the right, otherwise it returns false.
Equal to (===) — returns true if the value on the left is equal to the value on the right, otherwise it returns false.
Not equal to (!==) — returns true if the value on the left is not equal to the value on the right, otherwise it returns false.
152
Q

What data type do comparison expressions evaluate to?

A

boolean

153
Q

What is the purpose of an if statement?

A

To make a decision should i do this or not.

154
Q

Is else required in order to use an if statement?

A

No not necessary;

155
Q

Describe the syntax (structure) of an if statement.

A
if (condition) {
  //  block of code to be executed if the condition is true
}
If stmt (conditional block)
156
Q

What are the three logical operators?

A

OR , AND , NOT

157
Q

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

A

|| or &&and

158
Q

What are arrays used for?

A

To store a list of items or like values. Similar datas.

159
Q

Describe array literal notation.

A

Var name of array [square brackets with the values followed by a comma]

160
Q

How are arrays different from “plain” objects?

A

Array stores a list of like values
It has an index. “There’s an order.”
Object stores properties : describes the item.

161
Q

What number represents the first index of an array?

A

zero

162
Q

What is the length property of an array?

A

Calculates the number of items/values in the array.

Name of the array followed by a period and then the length property.

163
Q

How do you calculate the last index of an array?

A

Name of the array followed by a period and then length property minus 1

164
Q

What is a function in JavaScript?

A

set of task/procedures

165
Q

Describe the parts of a function definition.

A

function “name” (parameter) { code block};

166
Q

Describe the parts of a function call.

A

function name (argument);

167
Q

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

A
function definition = code block;
function call = contains argument
168
Q

What is the difference between a parameter and an argument?

A
parameter = placeholder;
argument = actual value
169
Q

Why are function parameters useful?

A

acts as placeholder . allows substitution

170
Q

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

A

returns a value

171
Q

What is the purpose of variables?

A

-a way for a script to store bits of information it needs to do its job. Variables can be represented by numbers, string, boolean, null, undefined,

172
Q

How do you declare a variable?

A

You can declare a variable by using “let, var, const”
Start with the variable keyword and then variable name
Example: var quantity;
var= keyword and quantity = variable name

173
Q

how to initialize a variable

A

Variable name = value
Using the assignment operator
Variable name+ “assignment operator =” + value

174
Q

What characters are allowed in variable names?

A

Start them with a letter, underscore _, or dollar sign $.
After the first letter, you can use numbers, as well as letters, underscores, or dollar signs.
Don’t use any of JavaScript’s reserved keywords.
What does it mean to say that variable names are “case sensitive”?
Uppercase and lowercase will have an effect on the name

175
Q

purpose of string

A

String is used to store text data

176
Q

What is the purpose of a number?

A

Store numerical values

Numbers are used for task that involves counting or calculating basically anything for math.

177
Q

What is the purpose of a boolean?

A

To store true or false values and comparison::for decision making

178
Q

What does the = operator mean in JavaScript?

A

It means that you are saying you are going to assign a value to a variable
Make that variable hold that value or contain that value.

179
Q

How do you update the value of a variable?

A

VariableName = whatever the new value is;

180
Q

What is the difference between null and undefined?

A

Null is used as a placeholder for a value you do not know yet.
Null and undefined : “ null is intentionally left empty”
Null at some point it has to be assigned a value in order for it to work.

181
Q

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

A

Let you know what that data is. Good habits to do so when you do console log you know what that data means.

182
Q

Give five examples of JavaScript primitives.

A

numbers, string, boolean, null, undefined, array, object

183
Q

What data type is returned by an arithmetic operation?

A

NUMBER VALUE DATA TYPE

Arithmetic operators perform basic math

184
Q

What is string concatenation?

A

Using the “+ the plus symbol” to join two variables or string.

185
Q

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

A

Addition: adds one value to another

186
Q

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

A

Boolean , true or false

187
Q

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

A

The addition assignment operator (+=) adds the value of the right operand to a variable and assigns the result to the variable.

188
Q

What are objects used for?

A

Objects group together a set of variables and function to create a model of something you would recognize from the real word.

189
Q

What are object properties?

A

If variables are part of an object is called a property. Property tells us about the object such as name of hotel or number of rooms it has

190
Q

Describe object literal notation.

A

Name of the variable {} curly bracelet

Key and value in the curly brackets and the method.}

191
Q

How do you remove a property from an object?

A

Delete objectname followed by a period and then the property name

192
Q

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

A

You can get or access the properties using the dot notation

Or the square bracket notation.

193
Q

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

A

Position: STATIC;

194
Q

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

A

Moves an element from the position it would be in normal flow, shifting it to top, right, bottom or left or where it would have been placed.

195
Q

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

A

Moves an element from the position it would be in normal flow, shifting it to top, right, bottom or left or where it would have been placed.

196
Q

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

A

Positions the element in relation to its containing element. It is taken out of the normal flow meaning that it does not affect the position of any surrounding elements.
Taken out of normal flow and no longer affects the position of other elements on the page

197
Q

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

A

Absolutely positioned elements move as users scroll up and down the page.

198
Q

What are the four box offset properties?

A

Top, bottom, left and right.

199
Q

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

A

Hex , name ,rgb