FrontEnd Flashcards

1
Q

Compare callbacks to promises in Node

A

A callback is a function that will run after another function has completed and returned, which is another way of saying “A callback is synchronous”.

A promise, on the other-hand, is asynchronous, it is often described as being a “future result of an async operation”.

Essentially when using Promises, we don’t wait for the first function to finish. Both functions run at the same time and they finish when they are done.

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

Have you had any experience with message queue systems and if so can you describe them.

A

I have not worked directly with them, but I know that we use them in the backend for both of the applications that I build.

We use them to send emails to volunteer managers when someone signs up to help with a task.

The premise of the message queue, in our system, is that we add all of the operations into a queue, and then when it reaches a set capacity, it runs a set of operations, in this case, generating emails and sending those out to users.

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

What is the difference between unit testing and integration testing?

A

Unit testing is the testing of small parts of an application, for instance, “When I run this function with these inputs, do I get the output that I anticipated?”.

Integration testing takes this a step further. We build the application and run it using a headless browser, like PhantomJS, and make sure that once all of the application’s components are built and running alongside one another, does the functionality of the application work as we expected?

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

How have you handled the concept of foreign key relationships in a NoSQL database?

A

There are a number of methods for this. The way that I would be inclined to use would be setting up the “relation” in the ORM model, I use Mongoose, which will allow us to write an id to multiple collections at once, or search for the same id across collections.

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

How have you handled performance concerns / scaling issues?

A

On the static sites that I’ve built for my company, I’ve taken advantage of pre-loading js and css libraries, which helps avoid flashing unstyled content.

In React, I’ve taken advantage of lifecycle methods that avoid re-rendering components unless a condition is met.

And I have also used ui-router extensively in production applications, so RESOLVING data and letting data get pulled in from a parent if it’s needed in multiple components.

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

What purpose do directives serve in AngularJS?

A

Directives are used in Angular to describe a DOM node that the html compiler will spit out. In that way, it’s very similar to something like React.

We describe our button and tell it that when we click on it, it should fire this function, and then Angular compiles that into a Button dom element with an on-click handler for us!

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

What are the three types of directives in AngularJS?

A

Components, Structural Directives, Attribute Directives.

Components are directives that come with a template.

Structural are used to change the shape of the DOM, showing/hiding a list.

Attribute components, change the appearance or attributes of another directive/component, very similar to addClass in jQuery.

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

What are the different ways you can bind data in AngularJS?

A

SINGLE OR DOUBLE BINDING -

Single binding just means that once the component is compiled and the data is bound into the template, that’s it, and we can’t change it. This is great for performance tweaking, because a single-binding doesn’t create any sort of scope.

Double-binding gives you a scope that allows the value to communicate with a controller and update after compilation. Binding data requires a lot of consideration to avoid causing considerable performance issues to the application.

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

What are the different ways you communicate between controllers in AngularJS?

A

The $rootScope service gives us access to $broadcast and $emit services, which we can listen to using the $on service.

For instance, when a user signs into my application and they haven’t given us access to show them browser notifications (think of Slack), I could broadcast the success of their login from my login controller and then listen to that on my header controller and display a call-to-action component, asking them for access to their browser’s notification api.

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

How would you specify that a scope variable should have one-way binding in AngularJS?

A

In the template binding, we put in two semi-colons before the variable, which is interpreted as a single bind.

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

Is it a good or bad practice to use AngularJS together with jQuery?

A

Bad. Not that it’s unforgivable, but you should be able to do anything that jQuery would allow before the nodes are generated in the DOM, and you shouldn’t need to run jQuery functions on that DOM.

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

Can you name some built-in AngularJS services?

A

$cookies, $window, $document, $location

There are quite a few, most of them bridging our application with the browser’s API, for instance, there are services for handling browser cookies, the window object, the document, and the location (aka window.location)
- These are extremely useful for building applications that need to store data in the user’s browser, or even just to tell the application what URL is currently open.

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

What’s a Retrospective

A

A “scrum ceremony” where the team meets and discusses the failures and successes of the most recent sprint, and brainstorm ways to improve.

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

What is NASH - backend?

A

DONT KNOW. DONT GUESS.

Oh, I never heard that term before. I’d love to get an explanation though!

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

What is NASH - backend?

A

DONT KNOW. DONT GUESS.

Oh, I never heard that term before. I’d love to get an explanation though!

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

’==’ vs ‘===’?

A

=== is used for strict comparisons, meaning that it will only compare a string to a string, and will not try to convert the values.

== will doing a very simple comparison of 2 values, and will try to coerce the second value into something that can be compared to the first.

Best practice is to use triple = for most cases.

17
Q

Inheritance in Javascript

A

We can define the prototype of a constructor, basically the initial values that will travel around with that object wherever we instantiate it.

Whereever we instantiate the object, we’ll have access to those stored prototype variables.

This means we’ll be able to add methods to the constructor’s prototype that acts on values stored inside it.

For example, we have a dog and we define a legs variable and set it to 4.
If we instantiate a New dog somewhere else and add a method to console log out dog.legs, we’ll always get 4.

18
Q

ES 6 Features

A

Fat arrow functions - which give you cleaner code, but doesn’t pass the reference to the THIS value, so they aren’t useful in every single case.

Object Property shorthand - if your key and value are the same, you don’t have to write it twice, so { x: x } becomes {x}

String Interpolation! 
let text = `The ${description}, fox jumped over the whatever whatever`

Modules
Constants

19
Q

What is a hashmap?

A

A storage structure that holds key value pairs and allows you to access the values by key.

Differ from basic objects because the contents of an Object are Stringified in Javascript

A hashmap can hold functions and other types, not just references to them, but the actual units.