Teh Codez Flashcards

1
Q

Webpack solves which fundamental problem?

A

bundling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the difference between /usr/bin and /usr/local/bin

A

/usr/local/bin is for locally compiled packages which upgrades may modify or delete without warning. /usr/bin is for distribution-managed programs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why use Webpack over a task runner such as Grunt or Gulp?

A

Webpack does all the preprocessing for you, and gives specified bundles based on configuration and the existing code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

npm: what is the difference between dependencies and devDependencies?

A

devDependencies are not installed in a directory with package.json with the –production flag. In other direcctories, they are not installed without the –dev flag. devDependencies are not installed transitively.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a source map?

A

A source map consists of information that can be used to map a compressed file back to its original sources.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Name several special characters in HTML.

A

& code ;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The shell: how do you go to the beginning of a line? To the end of the line? Delete everything right of the cursor?

A

CTRL-A, CTRL-E, CTRL-K

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you provide a default file name for a downloaded file?

A

Place the name of the file in the download attribute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a webpack loader?

A

A webpack loader is the equivalent of a task in most task runners. It preprocesses files as they are required.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you enforce order with webpack loaders?

A

Either use them right to left, bottom to top, or use the enforce flag in the rules, setting it either to pre or post.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Name two ways of passing parameters to loaders. Which is preferred?

A

Inline, and using the options object within the module rules. Options is preferred due to readability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In webpack, how can you use more than one loader?

A

Place separate loader configurations in the use array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Name at least four ways to blockquote HTML using tags.

A

blockquote, code, q, cite,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Name five tags for representing computer code.

A

code, pre, var , kbd, samp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What HTML tag is used to markup times and dates?

A

Use the time tag with the datetime attribute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Describe how React’s event handling differs from HTML’s syntactically.

A

HTML inline will list the event in lower case, and set the event to the name of the method, with parentheses, between quotes. React will list the event inline to the name of the method, camelCase, between curly braces.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Can you return false to prevent default behavior in React?

A

No, you must call preventDefault explicitly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What does the JavaScript bind() method do?

A

It creates a new function with the this keyword set to the provided value. If any other arguments are provided, they appear first in the new function. Habitually use bind whenever you refer to a method without () after it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

True or false: in JavaScript, class methods are bound by default.

A

False.

20
Q

In React, how do you prevent a component from rendering?

A

return null

21
Q

In React, describe a way you can conditionally render an element.

A

In curly brackets, use an expression with the && operator. The rhs will only render if the lhs is true.

22
Q

Describe JavaScript’s map function.

A

An array function, it returns a transformed array by taking a callback which has three arguments, an array element, the array index, and a reference to the initial array. The return value of the callback is the updated array element. The initial array is unchanged unless the developer explicitly changes it.

23
Q

Describe JavaScript’s filter function.

A

An array function, it returns values that return true for a given condition. It takes a callback and passes in three arguments, an array element, an index, and a reference to the initial array.

24
Q

Describe JavaScript’s reduce function.

A

An array function, it takes a callback that has four arguments, and an initial value. The callback takes an accumulator, the current array value, the current index, and a reference to the initial array. When the initial value is not given, the accumulator defaults to the first value of the array.

25
Q

How do you give React list elements a stable identity?

A

Among siblings, provide a unique key. If there is any ambiguity, make sure they’re on the component, not on the element.

26
Q

What two attributes should be set on a form tag?

A

action, where the form data will be sent, and method, which should be either get or post.

27
Q

What attribute is on the label tag?

A

for. It links the label to a widget by specifying the widget id.

28
Q

What possible three values may the type attribute of a button tag have?

A

submit, reset, button. Reset should not be used. Submit sends the data to the endpoint specified in the action attribute. button is useful for building custom JavaScript buttons.

29
Q

Why should form inputs have a name attribute?

A

The server needs a way to identify the data sent.

30
Q

What is a controlled React component?

A

A component whose state is tied to React’s state. For example, a user enters an input, onChange is called, setState is invoked. Every state mutation has a handler function.

31
Q

What makes a React textarea different?

A

It is written with a single tag, and uses a value attribute like an ordinary input for its value.

32
Q

What makes a React select element different?

A

A React select element uses a value on the select tag to identify the selected option, rather than placing a selected attribute directly on the option tag.

33
Q

In JavaScript, how do you create an object with properties, using the variable names as keys?

A

Use the es6 shorthand. Entering variables alone within curly braces is all the needed syntax.

34
Q

In JavaScript, what is the most elegant notation for adding object functions?

A

Inside the object definition, use the function name, arguments, and definition. In es6, no anonymous functions or property labels are required.

35
Q

In JavaScript, what is a computed property name?

A

Array brackets will compute the value between them when followed by a colon, when inside an object.

36
Q

In React, what is lifting state up?

A

When two components share a state, it should be moved up to the closest common ancestor.

37
Q

In React, a component does not know its children ahead of time. What do?

A

Pass them as children, render them as props.children.

38
Q

When building an initial static version of a React app, should you use props? Should you use state?

A

Use props. Do not use state. State is needed for interactivity, that is, data that changes over time.

39
Q

Why use Redux?

A

As a React project gets large, the front end should not know about the business logic. Redux gives each React component the exact piece of state it needs.

40
Q

How do you avoid mutations in Redux?

A

Use concat(), slice(), and …spread for arrays. Use Object.assign() and …spread() for objects.

41
Q

How do you get the object spread operator?

A

npm the babel-plugin-transform-object-rest-spread package, and update the babel configuration. transform-object-rest-spread should be in the plugins.

42
Q

Name a major gotcha when using morgan middleware for Express.

A

morgan must be used before routes are used, not after.

43
Q

Name a major gotcha when using Winston with express.

A

Be sure to use the full path using __dirname when setting up a transport.

44
Q

In express, when shouldn’t you use compression middleware?

A

Don’t use compression middleware when you have a reverse proxy.

45
Q

How do you see the git history?

A

git log