JS Exploration Interview part1

Get Started. It's Free
or sign up with your email address
JS Exploration Interview part1 by Mind Map: JS Exploration Interview part1

1. Array

1.1. iterative methods

1.1.1. every checks if condition matches

1.1.2. some like every but at elast one uses function single argument

1.1.3. lastIndexOf(elem) returns the last index additional start parameter index if negative starts right to lft

1.1.4. indexOf returns the first ocurrence index or -1 if not the negative start paramter reverses the search

1.1.5. includes(element, start)

1.1.6. forEach paramters optional this parameter

1.1.7. findIndex(function, optionalContext) paramters

1.1.8. array.find(function(currentValue, index, arr),thisValue) same as findIndex but returns the value

1.2. curiosities

1.2.1. assignign the same array to many variables does not duplicate

1.2.2. str.split() converts string to array if no param then splits by character arguments separator limit (optional)

1.2.3. arr.join(optionalSeparator) array to object

1.2.4. entries

1.3. sorts and mutations

1.3.1. sort with sort function

1.3.2. reverse

1.3.3. fill fill all the elements of an array with a static value array.fill(value, start, end) optional range parameters can be added.

1.3.4. splice(where, howManyRemove, [elems,...]) paramters

1.3.5. arr1.concat(arr1 [,arr2...])

1.3.6. slice(index) new copy slicing from

1.3.7. slice(from, to)

1.4. reducers

1.4.1. reduceRight(function(acum value, item), initialValue) Reduces the array to a single value from right to left params total currentValue currentIndex arr

1.4.2. reduce from left to right

1.4.3. map return a new array paramters function(currentValue, index, arr) optional value for (this)

1.4.4. filter returns an array of the elements of the array which passed the test function paramters

2. performance

2.1. do not modify the DOM cause of repaint

2.2. reflow

2.3. AnimationFrame

3. Computer Science

3.1. Binary Search JS

3.2. Radix sort alforithm O(nk)

4. DOM

4.1. DOM features

4.1.1. you can clone nodes

4.1.2. Selector functions getElementById hash getElementsByClassName getElementsByTagName getRootNode document.getElementsByTagNameNS document.querySelector document.querySelectorAll

4.1.3. Element tagName

4.2. DOM questions

4.2.1. JavaScript functions, how to find location of a node in a duplicate tree if you have the original node. As it is duplicated do a query by tag name and find index of with Array.prototype.indexOf.call(array, elem)

4.2.2. getElementById can safely assumed to be O(1) in a modern browser as a hashtable is the perfect data structure for the id=>element mapping.

4.3. DOM Navigation

4.3.1. parentNode

4.3.2. childNodes[nodenumber]

4.3.3. firstChild

4.3.4. lastChild

4.3.5. nextSibling

4.3.6. previousSibling

4.3.7. getRootNode()

4.3.8. Navigation tricks var i = Array.prototype.indexOf.call(e.childNodes, someChildEl);