Front End Flashcards
Name 3 ways to decrease page load speed
- Reduce Image Size, 2. Minify and combine files, 3. Minimize HTTP requests
What does Doctype do?
Informs the browser of the type and version of HTML
What are data- attributes good for?
The data attribute allows us to store extra information on HTML elements eg the position of an element
What is Javascript?
A client side and server side scripting language understood by web browsers
Why would you use a srcset attribute in an image tag
To select which image source to used based on criteria such as page width or pixel density
What is CSS selector specificity and how does it work?
Specificity is the means by which browsers decide which css rules to apply. Type < Class < Id
Can you explain the difference between px, em and rem as they relate to font sizing
Px are pixels as on the screen, em is relative to the font size of the element, Rem is relative to the font size of the element
Provide a use case for a pseudo class
:hover, :focus, to change styling on hover or focus
Explain Event Delegation
Using event.target so that if we have a lot of elements handled in the same way we can put a single event handler on a shared ancestor
Explain how this works in javascript
Refers to the context where it is revoked
Explain how prototypal inheritance works
prototypical inheritance refers to the ability to access object properties from another object. We use a JavaScript prototype to add new properties and methods to an existing object constructor.
Whats the difference between a variable that is null, undefined or undeclared?
null is a defined value, undefined means the variable had been declared and not given a value, undeclared means the variable has not been declared and will throw an error
What is a closure
A function enclosed within another function thats revoked immediately within the function
What language constructions do you use for iterating over object properties and array items?
While, for, do while, for in, for of
Difference between forEach and .map
Map returns the altered array while foreach returns undefined, you can chain methods onto map