Sumit | Javascript + React
Sumit | Javascript + React

@sumitsaurabh927

12 Tweets Mar 02, 2023
10 Javascript Concepts You Should Know
(A deep dive into all the concepts)
1. Call stack and execution context:
Call stack is a data structure that houses everything about current execution of the program.
Execution context refers to the environment within which code is being executed.
These two are closely related & show your depth of knowledge
2. typeOf vs == vs ===
'typeof' is an operator that returns the type of a variable.
'==' is the equality operator, which checks if the values of two operands are equal.
'===' is the strict equality operator, which checks if the values and types of two operands are equal.
3. map:
map() is a higher-order function that takes an array & a function as arguments & returns a new array with the function applied to each element of the array.
It modifies the data of an array without changing original array & is widely used in functional programming.
4. reduce:
reduce() is a higher-order function that takes an array and a function as arguments and returns a single value by applying the function to each element of the array and accumulating the result.
It condenses an array into a single value and is quite useful in FP.
5. filter:
filter() is a higher-order function that takes an array & a function as arguments & returns a new array with only the elements for which the function returns true.
It lets us select a subset of array based on a criteria & outputs an array of only chosen elements.
6. data types and var vs const vs let:
JS has six primitive & two composite data types. Read about them.
Also know the correct way to declare a variable (from var, let and const) and why it is the correct way.
These are quite commonly asked in interviews & so be well-versed.
7. Pure functions:
A pure function is a function that has no side effects and always returns the same output for a given input.
Pure functions have several benefits, like being easier to test and they also don't produce unintended consequences.
8. Side effect:
A side effect is any change in the state of a program that occurs as a result of a function being called.
Side effects includes modifying variables, modifying data in a database, or making network request.
Here is an example of a function with a side effect:
9. DOM:
The DOM (Document Object Model) represents the structure of a document as a tree of objects, with each object representing an element in the document.
Using DOM, we can modify the content of a document, as well as respond to events such as clicks and form submissions.
10. Event propagation:
Event propagation refers to the way in which events are handled in a program.
In JavaScript, events can bubble up through the DOM (Document Object Model) or they can be captured and handled at each level.
example of bubbling up of events:
I write threads daily on web dev so if you enjoyed this thread, please:
✅ Follow me @sumitsaurabh927 for more of these.
❤️ Each like, every comment of y'all motivates me to come up with awesome new stuff!
✅ RT the tweet below to show me some love.

Loading suggestions...