CAP Theorem stands for Consistency, Availability and Partition Tolerance. It was proposed by Eric Brewer in 1999. It is the basis theorem for distributed databases.

CAP theorem is a concept that distributed database systems can ONLY have 2 of the 3 concepts. It is not possible to have all 3 concepts simultaneously.

https://www.datastax.com/blog/how-apache-cassandratm-balances-consistency-availability-and-performance

Consistency

The same data must be available in all nodes in the cluster at the same time.

Availability

Every request must get a response whether it has succeeded or failed.

Partition Tolerance

The system continues to run without losing messages. …


this refers to an object which is executing the current bit of JavaScript code. There are 4 rules.

1. Simple Function Call

this is the global object in non-strict mode, and undefined in strict mode.

2. Implicit Binding

this points to the object on which the function is called (what’s to the left of the period when the function is called)

3. Explicit Binding

We can explicitly tell the JavaScript engine to set this to point to a certain value using call, apply or bind.

4. new Binding

Using the new keyword constructs a new object, and this points to it.

Summary

The JavaScript this keyword refers to the object it belongs to

  • In…

1. Implement your own content delivery network (CDN)

A collection of global servers share a website’s static files, such as CSS or Javascript, and they deliver from the server closest to the user’s physical location. In other words, when a user clicks on a video, the file loads faster because it’s distributed from a server nearby.

2. Use adaptive images

Most of the website’s page weight is from images. Use tools such as Picturefill or Adaptive Images to save bandwidth and improve page speed. Or adopt new image formats such as WebP and JPeg XR to reduce image weight without sacrificing image quality.

3. Cache

Browser caching stores cache versions of static resources. When…


Depth First Search

  • Uses a Stack data structure
  • It is an edge based technique
  • It performs two stages, first visited
  • Might traverse through more edges to reach a destination vertex from a source
  • Is more suitable when there are solutions away from the source
  • Is more suitable for game or puzzle problems. We make a decision then explore all paths through this decision. And if this decision leads to win situation, we stop.
  • Complexity is O(V+E) when adjacency list is used and O(V²) when Adjacency Matrix is used, where V stands for vertices and E stands for edges

Breadth First…


  1. What is a state?
  • It is an object that holds some information that may change over the lifetime of the component
  • Try to make the state as simple as possible and minimize the number of stateful components
  • state is similar to props, except it is private and fully controlled by the component
  • state is not accessible to any component other than the one that owns and sets it

2. What are props?

  • props are inputs to components
  • They are single values or objects containing a set of values that are passed to components on creation
  • They are data passed down…

  1. What is React?
  • It is a front-end Javascript library developed by Facebook in 2011
  • It uses the component based approach which helps in building reusable UI components

2. What are features of React?

  • It uses virtual DOM
  • It uses server-side rendering (this is a technique for rendering a client-side single page application on the server and then sending a fully rendered paged to the client)
  • It follow uni-directional data flow or data binding (state is passed to the view and child components)

3. What are some major advantages of React?

  • It increases the application’s performance
  • It can be conveniently used…

In JavaScript, we can check if a variable is an array by using 3 methods.

  1. isArray method
  2. instanceof operator
  3. checking the constructor type if it matches an Array object

Method 1: isArray Method

Checks…


Definition

  • ES5 stands for ECMA Script 5.
  • ES6 stands for ECMA Script 6.
  • ECMA is a scripting language used to standardize JavaScript and used for client-side scripting for websites.

Data Types

  • ES5: Supports data types, such as string, number, Boolean, null and undefined.
  • ES6: Introduced SYMBOL for unique values.

Arrow Function

  • ES5: Both functions and return keywords are needed to define the function
//ES5
var multiply = function(x,y) {
return x * y;
};
  • ES6: Keywords are not not needed to define the function
//ES6
const multiply = (x,y) => { return x * y };

Object Manipulation

  • ES5: Consumes more time when processing
  • ES6: Can be…

TLDR;

Manipulating the virtual DOM is like editing a blueprint.

Manipulating an actual DOM is like moving rooms in an actual house.

What problem does React Virtual DOM solve?

  • Current day websites require lots of DOM manipulation.
  • Why are most, other JavaScripts frameworks slow? JavaScript frameworks update the DOM much more than they have to.
  • For example, you have a list than contains 10 items. You check off the first item. Most JavaScript frameworks would rebuild the entire list. That is 10 times more work than necessary. Virtual DOM only updates what is necessary.
  • Virtual DOM solves the issue of slowness with efficient updating.

What is Virtual DOM?

  • In react, for…

Marika Lam

👩‍💻 Software engineer 📍Bay Area

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store