logged out
Dark Mode
Show all answers
About
All
OOP
NB
Arrays
Functions
Acronyms
Objects
Data Structures
Networking
Database
CSS
test
test2
Basics
Reveal answer.
What is tree shaking?
id:146
Tree shaking is a term commonly use for dead code elimination Capturing Capturing phase happens first. Moves from top level down the DOM tree to the target element. Then the Bubbling happens from there up. Capturing - document-> grandparent -> parent -> child Bubbling - move up the tree from child -> parent -> grandparent ->document. Capture events are added as a third parameter. Automatically set to false. child.addEventListener(‘click’, e => { console.log(‘I was clicked’) }, {capture: true} ) e.stopPropagation() => prevents any further capturing or bubbling
CSS
Reveal answer.
Difference between Static, Relative, Absolute and Fixed position?
id:79
static - default fixed - positioned relative to the viewport. WIll stay in the same position even if the page is scrolled. relative - relative to its normal position within the document flow absolute - relative to its closest relative positioned ancestor element. If it has no positioned ancestor it uses the doc body. inset: shorthand for position (top right bottom left)
Functions
Reveal answer.
Benefits of function declaration Vs function expression?
id:45
Function expressions do not pollute the global space. Function declarations provide more detail and context for error messages or debugging. Function declarations are used for recursion. Function expressions can be passed as an argument to another function, but function declarations can not.
Functions
NB
Reveal answer.
What is the difference between a function declaration and function expression?
id:44
Function declaration is when a function is given a name.(FD are hoisted, so can be invoked before the declaration) Function expressions do not have a name and do not get hoisted. Function expressions are invoked and forgotten immediately, therefore they avoid polluting the global scope. (Rule) The function declaration in a statement always starts with the keyword “function”, otherwise it is a function expression. function addUp(value1) // Function declaration const addUp = function(value1) // Function expression Function expressions can be declared to a variable and therefore they will have a .name property.
Reveal answer.
What is a library?
id:21
A library is a collection of prewritten functions, or code, which a programmer can use to avoid “reinventing” the wheel. This abstracts the implementation of these functions.