Complete Guide to All Javascript Concepts ( A-Z)_ Basic to Advanced _ by Omkar Talekar _ Nov, 2024 _ Medium
Complete Guide to All Javascript Concepts ( A-Z)_ Basic to Advanced _ by Omkar Talekar _ Nov, 2024 _ Medium
1
Search
Get unlimited access to the best of Medium for less than $1/week. Become a member
5. b. undefined : means that a variable has been declared but has not been assigned
a value, or a function doesn't return anything.
Type: It is its own type, undefined .
Usage: It’s the default value for uninitialized variables or function arguments
that are not passed. It also indicates that a function didn’t return anything.
9. Functions:
a. Function declarations vs expressions
b. Arrow functions
c. Immediately Invoked Function Expression (IIFE)
d. Higher-order functions (functions that take other functions as arguments or
return them)
e. Callback functions
11. Scope :
a. Global vs local scope
b. Function scope, block scope (with let and const)
12. Hoisting :
a. Variable hoisting
b. Function hoisting
14. Execution Context : An execution context is the environment in which the code
is executed.
a. Global Execution Context (GEC)
b. Function Execution Context
The Scope chain is a crucial concept that determines how variables are looked up in
different contexts when a function or block of code is executed
An Execution context is an abstract concept that represents the environment in
which the JavaScript code is evaluated and executed. Every time a function is
invoked or a block of code is run, a new execution context is created.
17. Debouncing : Limits the rate at which a function gets invoked. Helps avoid
multiple function calls for events that trigger frequently, such as keystrokes or resize
events.
18. Throttling : Ensures that a function is called at most once in a given period of
time, no matter how often the event is triggered.
19. Currying : Why: Currying transforms a function that takes multiple arguments
into a series of functions that each take one argument. This is useful for partially
applying arguments.
Where to use: Functional programming, reusing functions with fixed arguments.
21. Template Literals: Template literals, also known as template strings, are a
feature in JavaScript that allow for easier string interpolation and multi-line strings.
They are denoted by backticks (`) instead of single or double quotes.
sessionStorage : Known for storing data only for the duration of a single browser
session, clearing when the tab or browser is closed.
24. this Keyword : this keyword refers to the context in which a function is
executed. It is a special keyword that behaves differently depending on how a
function is called.
1. In the global execution context (outside any function), this refers to the global
object ( window in browsers, global in Node.js).
2. In a regular function (not in strict mode), this refers to the global object ( window
in the browser).
3. When a function is called as a method of an object, this refers to the object the
method is called on.
Classes In JavaScript
Classes and Objects in JavaScript
Inheritance in JavaScript
Encapsulation in JavaScript
OOP in JavaScript
26. Operators :
a. Arithmetic Operators: +, -, *, /, %
d. Assignment Operators: = , += , -= , *= , /=
Parameters are the variables defined in the function declaration (or function
signature) that specify what kind of values the function expects to receive when it is
called.
Arguments are the actual values passed to the function when it is called.
29. Destructuring : Destructuring is a syntax in JavaScript that allows you to unpack
values from arrays or properties from objects into distinct variables. It simplifies the
process of extracting multiple properties or elements from an object or array,
making your code cleaner and more readable.
a. Array destructuring
b. Object Destructuring
30. Rest and Spread Operator : The Rest and Spread operators are both represented
by ... in JavaScript, but they serve different purposes depending on how they are
used.
The Rest operator is used to collect multiple elements and bundle them into a single
array or object. It’s mainly used in function parameters to collect arguments, or in
destructuring to collect remaining properties.
The Spread operator is used to unpack elements of an array or object into individual
elements or properties. It allows you to expand or “spread” an iterable (array or
object) into individual elements or properties.
33. Currying: Converting a function that takes multiple arguments into a sequence
of functions
34. Anonymous functions : An anonymous function is a function that does not have
a name. These functions are typically defined inline and can be assigned to
variables, passed as arguments, or used in other places where a function is required.
Key Characteristics:
35. Lexical scoping : The process of determining the scopes of the variables or
functions during runtime is called lexical scoping.
When you define a function, it has access to variables that are within its scope
(i.e., variables declared inside the function and variables from outer functions,
including the global scope).
If a function is nested inside another, the inner function can access variables
from the outer function (this is called closures).
find() , findIndex()
sort() , reverse()
join() , split()
38. Prototypes :
Prototype chain
39. Classes
Class syntax, constructors, methods
40. call(), apply(), and bind() : for controlling the context of this
Event Bubbling occurs when an event is triggered on an element, and the event then
“bubbles up” from the target element to its ancestor elements in the DOM tree. In
most cases, events bubble up by default unless you specifically prevent it
Event Capturing is the opposite of event bubbling. The event is first captured by the
root element and then trickles down to the target element.
44. Polyfill
Why: Adds support for features that are not natively available in older browsers by
providing code that mimics modern functionality.
Where to use: Ensuring compatibility with older browsers (e.g., older versions of
Internet Explorer) for new JavaScript features like Promise, fetch, etc.
Observer Pattern: Notifying multiple objects when one object’s state changes.
Factory Pattern: Provides a way to instantiate objects while keeping the creation
logic separate from the rest of the application.
JSON Basics
DOM Selection
document.getElementById() , document.querySelector() ,
document.querySelectorAll()
Event Handling
removeChild() )
DOM Traversal
fromCharCode() .
54. Date methods:
Date.now() , Date.parse() , Date.UTC() , getDate() , getDay() , getFullYear() ,
55. Generator: A generator in JavaScript is a special type of function that allows you
to pause and resume its execution.
function* , yield , next() , return() , throw() .
56. JavaScript Proxy : A Proxy in JavaScript is a special object that allows you to
intercept and customize operations on objects, such as property access, assignment,
function calls, and more. It acts as a wrapper for another object and can redefine
fundamental operations (like get , set , deleteProperty , etc.) on that object.
A shallow clone of an object or array creates a new instance, but it only copies the
top-level properties or elements. If the original object or array contains references
to other objects (nested objects or arrays), these inner objects are not copied.
Instead, the shallow clone will reference the same objects.
A deep clone creates a completely independent copy of the original object or array.
It recursively copies all the properties or elements, including nested objects or
arrays. This means that deep cloning ensures that no references to nested objects
are shared between the original and the clone.
Loose equality compares two values for equality after performing type coercion.
This means that the values are converted to a common type (if they are of different
types) before making the comparison.
When using == , JavaScript attempts to convert the operands to the same type before
comparing them.
Strict equality compares two values without performing any type conversion. It
checks both the value and the type of the operands.
For === , the operands must be of the same type and value to be considered equal.
60. JavaScript Set : A Set in JavaScript is a built-in collection object that allows you to
store unique values of any type, whether primitive or object references.
2. Ordered: The elements in a Set are ordered, meaning the values are stored in the
order they were added. However, Sets do not allow duplicate entries.
3. Iterable: Sets are iterable, so you can loop over the elements in a Set using
for...of , or methods like .forEach() .
4. No Indexes: Unlike Arrays, Set elements are not accessed by an index. They are
stored by insertion order, but you can’t reference them by a number.
1. add(value) : Adds a value to the Set. If the value already exists, it does nothing
(no duplicates).
2. has(value) : Checks if the Set contains the specified value. Returns true or
false .
6. forEach(callback) : Executes a provided function once for each value in the Set.
61. JavaScript Map : A Map in JavaScript is a built-in object that stores key-value
pairs. Unlike regular JavaScript objects, Maps allow keys of any data type (including
objects, functions, and primitive types like strings and numbers) to be used.
Maps also maintain the insertion order of their keys, making them useful in
scenarios where order matters.
1. set(key, value) : Adds or updates an element with the specified key and value in
the Map.
8. keys() : Returns an iterator object containing all the keys in the Map.
9. values() : Returns an iterator object containing all the values in the Map.
10. entries() : Returns an iterator object containing an array of [key, value] pairs.
62. The Fetch API: The Fetch API allows us to make async requests to web servers
from the browser. It returns a promise every time a request is made which is then
further used to retrieve the response of the request.
63. Import/Export:
Modules: In JavaScript, a module is a file that contains code you want to reuse.
Instead of having everything in one file, you can split your code into separate files
and then import what you need. This keeps the code clean, organized, and
maintainable.
Imports: This is how you bring in functionality from other modules into your
current file.
Exports: This is how you make variables, functions, classes, or objects from one
module available for use in other modules.
64. Pure Functions, Side Effects, State Mutation and Event Propagation:
65. Recursion:
Recursion is a fundamental programming concept where a function calls itself in
order to solve a problem. Recursion is often used when a problem can be broken
down into smaller, similar sub-problems. In JavaScript, recursion is useful for tasks
like traversing trees, solving puzzles, and more.
Key Concepts:
1. Base Case: The condition that stops the recursion. Without a base case,
recursion can lead to infinite function calls, causing a stack overflow error.
2. Recursive Case: The part of the recursion where the function calls itself with a
smaller or simpler version of the problem.
66. The apply, call, and bind methods:
mouseleave , contextmenu .
71. Debugging:
73. Web Workers: A mechanism for running scripts in background threads, allowing
JavaScript to perform computationally expensive tasks without blocking the main
thread.
74. Service Workers: A script that runs in the background of your browser, enabling
features like push notifications, background sync, and caching for offline
functionality.
Lazy Loading and Infinite Scrolling are two techniques commonly used to enhance
performance and user experience in web applications, especially when dealing with
large amounts of data or media (like images, lists, or articles).
76: Progressive Web Apps (PWAs): Building web applications that work offline,
provide push notifications, and have native-like performance (through service
workers and other browser APIs).
77. Server-sent events : Server-sent events (SSE) are a simple and efficient
technology for enabling real-time updates from the server to the client over a
single HTTP connection.
78.Strict Mode : Strict Mode is a feature in JavaScript that ensures that you avoid
errors and problematic features.
80. Temporal Dead Zone (TDZ) : It is a term that refers to the period of time between
the creation of a variable and its initialization in the execution context. During this
time, the variable exists but cannot be accessed — attempting to do so will result in a
ReferenceError.
The TDZ occurs for variables declared using let and const but not for var because
var declarations are hoisted and initialized with undefined .
Thats it guys.
Thank you for taking the time to read my blog! I hope you found it helpful and
informative. If I missed any important topics or concepts, I sincerely apologize. Feel
free to leave a comment or reach out if you have any questions or suggestions. Your
feedback is always appreciated!
JavaScript Web3 Interview Coding Development
Follow
Software Engineer @ANQ • React JS • React Native • Node JS • JavaScript • Typescript Docker • AWS • DSA •
System Design | Full Stack Developement
Responses (5)
Respond
user02106
3 days ago
51 1 reply Reply
Vipul Agarwal he
3 days ago
helpful
1 1 reply Reply
Subham
3 days ago
Wow!
1 1 reply Reply
Nov 12 3.9K 52
Harendra
Oct 26 5.4K 70
Lists
Growth Marketing
11 stories · 281 saves
In Code Like A Girl by Surabhi Gupta
Sep 26 3.4K 74
Codingwinner
3d ago 443 9
In Coding Beauty by Tari Ibaba
Sep 17 4.5K 64