Week 1 Flashcards
Name two types of units that can be used to adjust font-size in CSS.
pixels, px and rem/em, and percentages, % (do not use percentage)
What CSS property controls the font used for the text inside an element?
font-family, e.g. body {font-family: sans-serif}
What CSS properties make up the box model?
content, padding, margin,border
Which CSS property pushes boxes away from each other?
margin
Which CSS property add space between a box’s content and its border?
padding
What is the default flex-direction of a flex container?
row (horizontally), left to right
What is the default flex-wrap of a flex container?
nowrap (none)
Why do two div elements “vertically stack” on one another by default?
they are by default block level, i.e. display: block
What is the default flex-direction of an element with display: flex?
horizontal, left to right
What are the three primary components of a page layout? (Which helper classes do you need?)
row, column, container
What is the minimum number of columns that you should put in a row?
one
What is the purpose of a container?
to encase things so you can flexbox?
What is the default value for the position property of HTML elements?
static
How does setting position: relative on an element affect document flow?
It doesn’t but items inside will move if removed from doc flow?
How does setting position: relative on an element affect where it appears on the page?
How does setting position: absolute on an element affect where it appears on the page?
How do you constrain an absolutely positioned element to a containing block?
What are the four box offset properties?
left, right, bottom, top
how do you overlay items on top of each other?
you can adjust ordering using “z-index”
Why do we log things to the console?
to make sure your code is working!
What is a method?
A method is a function which is a property of an object. There are two kinds of methods: instance methods which are built-in tasks performed by an object instance, or static methods which are tasks that are called directly on an object constructor.
How is a method different from any other function?
it is a property of an object
How do you remove the last element from an array?
pop() method
How do you round a number down to the nearest integer?
Math.floor() method
How do you generate a random number?
Math.random() method
How do you delete an element from an array?
.splice() method
How do you append an element to right end of an array?
.push() method
How do you break a string up into an array?
.split() method
Do string methods change the original string? How would you check if you weren’t sure?
No, strings are immutable.
to check, console log it
Roughly how many string methods are there according to the MDN Web docs?
around 50
Is the return value of a function or method useful in every situation?
no because you might use/do somthing different in the function later
Roughly how many array methods are there according to the MDN Web docs?
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDN !
how do u link js file to html?
<body>
</body>
Give 6 examples of comparison operators.
&& || < > etc..
What data type do comparison expressions evaluate to?
bulion
What is the purpose of an if statement?
conditions
Is else required in order to use an if statement?
no
Describe the syntax (structure) of an if statement.
if (a < b) {return false}
What are the three logical operators?
How do you compare two different expressions in the same condition?
What are the three logical operators?
How do you compare two different expressions in the same condition?
using “and” or “or”
What is the purpose of a loop?
run code repeated times under specific conditions
What is the purpose of a condition expression in a loop?
tells how long / many times loop to run for
What does “iteration” mean in the context of loops?
number of times loop runs
When does the condition expression of a while loop get evaluated?
at beginning of each iteration
When does the initialization expression of a for loop get evaluated?
at start of loop
When does the condition expression of a for loop get evaluated?
after initialization and after every iteration
When does the final expression of a for loop get evaluated?
after the iteration
Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?
the break keyword
What does the ++ increment operator do?
increments value by 1
How do you iterate through the keys of an object?
“for in” loop
how do use find loop debugger?
something like this!: inspector, sources, , main d js, left click, debugger, or enter debugger keyword above console log in code block
What are the four components of “the Cascade”.
source order, specificity, inheritance, important
What does the term “source order” mean with respect to CSS?
the order in which css rules are written in stylesheet and order in which they are prioritized (last being hightest priority)
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
using inheritance if it is available. inheritance will apply to other items inside the element.
List the three selector types in order of increasing specificity.
element, class, ID
Why is using !important considered bad practice?
because it implies one is not following other best practices by organizing code correctly
selecotors by priority order
(lowest to hightest)
universal selector(*),
element,
class,
id,
inline,
important