JS Exploration Interview part1

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

1. Array

1.1. iterative methods

1.1.1. every

1.1.1.1. checks if condition matches

1.1.2. some

1.1.2.1. like every but at elast one

1.1.2.2. uses function single argument

1.1.3. lastIndexOf(elem)

1.1.3.1. returns the last index

1.1.3.2. additional start parameter index

1.1.3.3. if negative starts right to lft

1.1.4. indexOf

1.1.4.1. returns the first ocurrence index or -1 if not

1.1.4.2. the negative start paramter reverses the search

1.1.5. includes(element, start)

1.1.6. forEach

1.1.6.1. paramters

1.1.6.2. optional this parameter

1.1.7. findIndex(function, optionalContext)

1.1.7.1. paramters

1.1.8. array.find(function(currentValue, index, arr),thisValue)

1.1.8.1. 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()

1.2.2.1. converts string to array

1.2.2.2. if no param then splits by character

1.2.2.3. arguments

1.2.2.3.1. separator

1.2.2.3.2. limit (optional)

1.2.3. arr.join(optionalSeparator)

1.2.3.1. array to object

1.2.4. entries

1.3. sorts and mutations

1.3.1. sort

1.3.1.1. with sort function

1.3.2. reverse

1.3.3. fill

1.3.3.1. fill all the elements of an array with a static value

1.3.3.2. array.fill(value, start, end)

1.3.3.2.1. optional range parameters can be added.

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

1.3.4.1. paramters

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

1.3.6. slice(index)

1.3.6.1. new copy slicing from

1.3.7. slice(from, to)

1.4. reducers

1.4.1. reduceRight(function(acum value, item), initialValue)

1.4.1.1. Reduces the array to a single value

1.4.1.2. from right to left

1.4.1.3. params

1.4.1.3.1. total

1.4.1.3.2. currentValue

1.4.1.3.3. currentIndex

1.4.1.3.4. arr

1.4.2. reduce

1.4.2.1. from left to right

1.4.3. map

1.4.3.1. return a new array

1.4.3.2. paramters

1.4.3.2.1. function(currentValue, index, arr)

1.4.3.2.2. optional value for (this)

1.4.4. filter

1.4.4.1. returns an array of the elements of the array which passed the test function

1.4.4.2. 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

4.1.2.1. getElementById

4.1.2.1.1. hash

4.1.2.2. getElementsByClassName

4.1.2.3. getElementsByTagName

4.1.2.4. getRootNode

4.1.2.5. document.getElementsByTagNameNS

4.1.2.6. document.querySelector

4.1.2.7. document.querySelectorAll

4.1.3. Element

4.1.3.1. 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.

4.2.1.1. 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

4.3.8.1. var i = Array.prototype.indexOf.call(e.childNodes, someChildEl);