Glossary Flashcards

1
Q

When is code Asynchronous?

A

Code is asynchronous when you initiate something, forget about it, and when the result is ready you get it back without having to wait for it. It might take even seconds and in the meantime you complete other stuff, and when the response it ready, the callback function gets called.

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

What’s an example of Asynchronous?

A

AJAX call.

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

What’s a modern way to handle async?

A

Promises and async

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

In JavaScript, Block is created by?

A

curly braces {}.

eg.) if statement contains a block, a for loop contains a block.

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

Block Scoping

A

When a variable in a block is visible and accessible from inside the whole block, but not outside of it.

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

Callback

A

A callback is function that’s invoked when something happens.

eg.) A click event associated to an element has a callback function that’s invoked when the user clicks the element. A fetch request has a callback that’s called when the resource is downloaded.

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

Declarative

A

A declarative approach is when you tell the machine what you need to do, and you let if figure out the details.

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

Why is React considered declarative?

A

Because you reason about abstractions rather than editing the DOM directly.

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

A “Fallback” is used for?

A

Is used to provide a good experience when a user hasn’t access to a particular functionality.
eg.) a user that browses with JavaScript disabled should be able to have a fallback to a plain HTML version of the page. Or for a browser that has not implemented an API, you should have a fallback to avoid completely breaking the experience of the user.

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

Function Scoping

A

Any variable defined in a function is visible and accessible from inside the whole function.

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

Immutability

A

A variable is immutable when its value cannot change after it’s created.

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

Mutable

A

A variable that can be changed.

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

Lexical Scoping

A

A particular kind of scoping where variables of a parent function are made available to inner functions as well.

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

Polyfill

A

A way to provide new functionality available in modern JavaScript or a modern browser API to older browsers.

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

Pure Function

A

A function that has no side effects (does not modify external resources), and its output is only determined by the arguments. You could call this function 1M times, and given the same set of arguments, the output will always be the same.

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

Reassignment

A

JavaScript with var and let declaration allows you to reassign a variable indefinitely. With constdeclarations you effectively declare an immutable value for strings, integers, booleans, and an object that cannot be reassigned (but you can still modify it through its methods).

17
Q

Scope

A

Scope is the set of variables that’s visible to a part of the program.

18
Q

Scoping

A

Scoping is the set of rules that’s defined in a programming language to determine the value of a variable.

19
Q

Shim

A

A shim is a little wrapper around a functionality, or API. It’s generally used to abstract something, pre-fill parameters or add a polyfill for browsers that do not support some functionality. You can consider it like a compatibility layer.

20
Q

Side effect

A

A side effect is when a function interacts with some other function or object outside it. Interaction with the network or the file system, or with the UI, are all side effects.

21
Q

State

A

State usually comes into play when talking about Components. A component can be stateful if it manages its own data, or stateless if it doesn’t.

22
Q

Stateful

A

A stateful component, function or class manages its own state (data). It could store an array, a counter or anything else.

23
Q

Stateless

A

A stateless component, function or class is also called dumb because it’s incapable of having its own data to make decisions, so its output or presentation is entirely based on its arguments. This implies that pure functions are stateless.

24
Q

Strict mode

A

Strict mode is an ECMAScript 5.1 new feature, which causes the JavaScript runtime to catch more errors, but it helps you improve the JavaScript code by denying undeclared variables and other things that might cause overlooked issues like duplicated object properties and other subtle things. Hint: use it. The alternative is “sloppy mode” which is not a good thing even looking at the name we gave it.

25
Q

Tree Shaking

A

Tree shaking means removing “dead code” from the bundle you ship to your users. If you add some code that you never use in your import statements, that’s not going to be sent to the users of your app, to reduce file size and loading time.