Javascript Flashcards
WithOUT ES6, how are class properties inherited from the parent?
Parent.call(property1, …propertyN)
WITH ES6, how are class properties inherited from the parent?
class Child extends Parent, call super() in constructor
WithOUT ES6, how are class methods inherited from the parent?
Child.prototype = Object.create(Parent.prototype)
How do you access class properties?
this
How do you access class methods?
prototype
How to make an AJAX or async call from the browser using vanilla JS?
new XMLHttpRequest();
req. addEventListener(“load”, reqListener);
req. open(“GET”, “http://www.example.org/example.txt”);
req. send();
How to create a new regular expression
/something/ or new RegExp()
How to specify a “character” in regex?
\w
How to specify a number in regex?
\d - Decimal
\D - non-decimal
How to test a regex?
String.prototype.match or RegExp.prototype.exec
What does the i modifier do in a regex?
case-insensitive
What is the map function?
Get a new array by applying a transformation function on each and every element in the array (immutable)
What does reduce function do?
Reduce function reduces a given list to one final result (immutable)
What are the arguments to the reduce function?
function(accumulator, currentEl, index), initialAccumulatorValue
What does filter do?
Evaluates each element of the array against a criteria, and returns a new array with only elements that return true (immutable)