Theory
Theory
Server communication
● Server communication refers to the process of exchanging data or information
between a client (such as a web browser or a mobile app) and a server. It involves
making requests from the client to the server and receiving responses in return.
● The choice of the communication method depends on the specific requirements of
the application, including factors such as real-time updates, data size, scalability, and
the desired level of interactivity between the client and server.
HTTP vs HTTPS
● HTTPS provides a secure and encrypted connection between clients and servers,
protecting sensitive data from eavesdropping and unauthorised access. It is essential
for websites that handle sensitive information and is increasingly becoming the
preferred protocol for secure web communication.
request and response header
● Request and response headers are part of the HTTP (Hypertext Transfer Protocol)
protocol used for communication between clients (such as web browsers) and
servers. Headers contain additional information about the request or response,
providing context and instructions for handling the data being exchanged.
● Headers play a crucial role in the communication process, allowing clients and
servers to exchange information and instruct each other on how to handle the
request or response. They enable customization, control, and coordination between
the different components involved in the HTTP communication.
node blocking vs asynchronous
● In Node.js, the terms "blocking" and "asynchronous" refer to different approaches for
handling I/O (Input/Output) operations, such as reading from or writing to files,
making network requests, or accessing databases.
● Node.js is designed to leverage asynchronous I/O and provides an event-driven
architecture that allows developers to write highly scalable and performant
applications. By using non-blocking I/O operations and callbacks or promises,
Node.js can handle high concurrency and efficiently handle multiple I/O tasks without
getting blocked by slow operations.
● It's important to note that while Node.js encourages asynchronous programming
URL Encoder:
● URL Encoder is a mechanism used to convert special characters and non-ASCII
characters in a URL into a format that can be safely transmitted over the internet.
MVC:
● MVC (Model-View-Controller) is a software architectural pattern used to structure
applications. It separates the application into three components: the model (data and
business logic), the view (user interface), and the controller (handles user
interactions and updates the model and view).
Prototype Inheritance:
● Prototype Inheritance is a mechanism in JavaScript that allows objects to inherit
properties and methods from a prototype object. Objects can have a prototype object
from which they inherit properties and behavior.
Prototype Chaining:
● Prototype Chaining is the process of traversing the prototype chain to access
properties and methods of an object's prototype and its parent prototypes.
Scope Temporal Dead Zone:
● The Temporal Dead Zone refers to the period in JavaScript between the creation of a
variable using let or const and its declaration, where accessing the variable results in
a ReferenceError.
Shallow Cloning and Deep Cloning:
● Shallow cloning creates a new object with the same properties as the original object,
but the properties that are objects are still references to the original object. Deep
cloning creates a new object with entirely new copies of all nested objects and
properties.
Structured Cloning:
● Structured Cloning is a mechanism in JavaScript that allows objects to be serialized
and transferred between different execution contexts, such as web workers or cross-
origin frames.
Scope Chaining (let vs var):
● With let, variables are block-scoped, meaning they are only accessible within the
block they are declared in. With var, variables are function-scoped, meaning they are
accessible within the entire function they are declared in.
indexOf:
● The indexOf method is used to find the index of a specified value within a string or
array. It returns the index of the first occurrence of the value, or -1 if the value is not
found.
Substring:
● Substring is a method used to extract a portion of a string based on its index
positions. It takes a start index and an optional end index and returns the extracted
substring.
Interpreter and Compiler:
● An interpreter translates and executes code line by line, while a compiler translates
the entire code into machine-readable instructions before execution.
Call, Bind, Apply:
● Call: The call() method is used to invoke a function with a specified this value and
arguments provided individually. It takes the function's this context as its first
argument, followed by any additional arguments for the function. The call() method
allows you to borrow a method from one object and invoke it on anot
● Bind: The bind() method creates a new function that, when called, has its this
keyword set to a specified value. It allows you to permanently bind a function to a
specific context. The bind() method returns a new function with the bound context
and any provided arguments.
● Apply: The apply() method is similar to call(), but it takes an array-like object as its
second argument that represents the arguments to be passed to the function. This is
useful when you have an array of values that you want to pass as individual
arguments to a function.
● In summary, call() and apply() allow you to invoke a function with a specific context
and individual or array-like arguments, respectively. On the other hand, bind()
creates a new function with a permanently bound context, which can be called later
with its own arguments.
Prototype vs Proto:
● Prototype refers to the property of a constructor function that is used as a blueprint
for creating objects. Proto is the property of an object that references its prototype.
Object Constructors:
● Object Constructors are functions used to create objects with predefined properties
and methods. They serve as blueprints for creating multiple instances of similar
objects.
ES6 vs ES7:
● ES6 (ECMAScript 2015) and ES7 (ECMAScript 2016) are versions of the
ECMAScript standard that introduced new features to the JavaScript language. ES6
brought significant enhancements, while ES7 introduced smaller additions to the
language.
Pass by Reference & Pass by Value:
● Pass by Reference means that when passing an object as a parameter to a function,
the reference to the object is passed. Changes made to the object inside the function
will affect the original object. Pass by Value means that when passing a primitive
data type as a parameter to a function, a copy of the value is passed. Changes made
to the value inside the function do not affect the original value.
Redirect Issue - Using DOM:
● Redirect issue refers to problems encountered when attempting to redirect a user to
a different page in a web application. Using DOM (Document Object Model)
manipulation, such as setting the window.location property, can be a common
approach to perform a redirect.
Promise.all:
● Promise.all is a method in JavaScript that takes an array of promises and returns a
single promise that is fulfilled when all the promises in the array are resolved. It
allows you to handle multiple asynchronous operations simultaneously.
Error-First Callback:
● Error-First Callback is a common convention in Node.js for handling asynchronous
operations. It involves passing a callback function as the last argument to an
asynchronous function, where the first parameter of the callback is reserved for an
error object (if any), and subsequent parameters hold the result or data.
Query Selector & Query Selector All:
● Query Selector is a method in JavaScript that allows you to select and retrieve the
first matching element in the DOM based on a CSS selector. Query Selector All
returns a NodeList containing all elements that match the provided selector.
Append:
● Append is a method in JavaScript that allows you to add an element or a string of
HTML as a child of another element. It adds the specified content to the end of the
target element.
Create Element:
● Create Element is a method in JavaScript used to dynamically create a new HTML
element. It creates an element node with the specified tag name.
Add Event:
● Add Event is a method in JavaScript used to attach an event listener to an element. It
allows you to specify a function that will be executed when the specified event occurs
on the element.
Blocking Code:
● Blocking code refers to code that causes the program execution to pause until a
particular operation completes. In Node.js, blocking code can negatively impact
performance because it prevents the event loop from processing other events or
requests until the blocking operation finishes.
JSON Parse:
● JSON Parse is a method in JavaScript used to parse a JSON string and convert it
into a JavaScript object. It takes a valid JSON string as input and returns the
corresponding JavaScript object.
JSON Stringify:
● JSON Stringify is a method in JavaScript used to convert a JavaScript object into a
JSON string. It serializes the object, including its properties and values, into a JSON-
formatted string.
Conditional Operator vs Optional Operator:
● The conditional operator (ternary operator) in JavaScript is a concise way to write
conditional expressions. It evaluates a condition and returns one value if the
condition is true and another value if it's false. The optional chaining operator (?.) is
used to access properties or call functions on an object that may be null or
undefined, preventing errors by gracefully handling missing values.
Fork Function:
● Fork function is a concept in programming where a new child process is created from
an existing parent process. The child process runs independently but shares some
resources with the parent process, such as code and memory.
Router.all:
● Router.all is a method in web application frameworks, such as Express.js, used to
define a route handler that handles all HTTP methods (GET, POST, PUT, DELETE,
etc.) for a specific route.
Push to array vs Add to Set:
● Push is a method used to add an element to the end of an array. Add to Set is a
method used to add an element to a Set data structure. The difference is that push
adds the element to an array, allowing duplicates, while add to set adds the element
to a Set, ensuring uniqueness.
Syntax Parsing:
● Syntax Parsing is the process of analyzing the structure and grammar of a
programming language to determine its meaning and validity. It involves breaking
down the code into tokens and applying language rules to understand the code's
structure and identify any syntax errors.