m3-0822 Flashcards
What is Array.prototype.filter useful for?
The filter() method creates a shallow copy of a portion of a given array, filtered down to just the elements from the given array that pass the test implemented by the provided function.
useful for getting values from an array that meet the conditions you specify
What is Array.prototype.map useful for?
The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.
useful for manipulating each element of an array in the way specified
Creating a new array containing the transformed elements of another.
What is Array.prototype.reduce useful for?
Perhaps the easiest-to-understand case for reduce() is to return the sum of all the elements in an array
run through an array and performing the same operation on each element cumulatively
Combining the elements of an array into a single value.
What is “syntactic sugar”?
syntactic sugar is syntax within a programming language that is designed to make things easier to read or to express
What is the typeof an ES6 class?
function
Describe ES6 class syntax.
class keyword, followed by the name of the class
inside the code block, constructor method where you can initialize the properties of an instance and other methods can be added
What is “refactoring”?
code refactoring is the process of restructuring existing computer code—changing the factoring—without changing its external behavior
What is Webpack?
It’s a tool that lets you bundle your JavaScript applications (supporting both ESM and CommonJS), and it can be extended to support many different assets such as images, fonts and stylesheets.
Webpack is a helpful tool we use during development to write code that is readable to us but usable by browsers.
How do you add a devDependency to a package?
npm install –save-dev (name of package)
What is an NPM script?
way to bundle shell commands
help us run repetitive tasks, automates tasks
How do you execute Webpack with npm run?
add npm script to package.json named “build” that executes “webpack” and then npm run build in the CLI
How are ES Modules different from CommonJS modules?
Their syntax is even more compact than CommonJS’s.
Their structure can be statically analyzed (for static checking, optimization, etc.).
Their support for cyclic dependencies is better than CommonJS’s.
What kind of modules can Webpack support?
ECMAScript modules. CommonJS modules. AMD modules.
What is React?
A JavaScript library for building user interfaces
What is a React element?
React Element - It is a simple object that describes a DOM node and its attributes or properties you can say. It is an immutable description object and you can not apply any methods on it.
How do you mount a React element to the DOM?
calling the render method of the React root object
What is Babel?
Babel is a JavaScript compiler that converts code to older syntax.
What is a Plug-in?
a software component that adds a specific feature to an existing computer program