Skip to content

Commit c494b22

Browse files
authored
Merge pull request #505 from sudhanshutiwary69868/patch-1
Update README.md
2 parents f03cf53 + 6147130 commit c494b22

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

README.md

+37-2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ All the translations for this repo will be listed below:
103103

104104
## 1. Call Stack
105105

106+
The call stack is a mechanism that the JavaScript interpreter uses to keep track of function execution within a program. In JavaScript, functions are executed in the order they are called. The call stack follows the Last In, First Out (LIFO) principle, meaning that the last function pushed onto the stack is the first one to be executed.
107+
108+
According to the ECMAScript specification, the call stack is defined as part of the execution context. Whenever a function is called, a new execution context is created and placed at the top of the stack. Once the function completes, its execution context is removed from the stack, and control returns to the previous context. This helps manage synchronous code execution, as each function call must complete before the next one can begin.
109+
106110
### Reference
107111

108112
- [Call Stack — MDN](https://developer.mozilla.org/en-US/docs/Glossary/Call_stack)
@@ -138,6 +142,9 @@ All the translations for this repo will be listed below:
138142
---
139143

140144
## 2. Primitive Types
145+
According to the ECMAScript specification, JavaScript has six primitive data types: string, number, bigint, boolean, undefined, and symbol. These types are immutable, meaning their values cannot be altered. There is also a special primitive type called null, which represents the intentional absence of any object value.
146+
147+
Primitive values are directly assigned to a variable, and when you manipulate a primitive type, you're working directly on the value. Unlike objects, primitives do not have properties or methods, but JavaScript automatically wraps primitive values with object counterparts when necessary (e.g., when calling methods on strings).
141148

142149
### Reference
143150

@@ -175,6 +182,7 @@ All the translations for this repo will be listed below:
175182
---
176183

177184
## 3. Value Types and Reference Types
185+
According to the ECMAScript specification, value types are stored directly in the location that the variable accesses. These include types like number, string, boolean, undefined, bigint, symbol, and null. When you assign a value type to a variable, the value itself is stored.
178186

179187
### <img align= center width=40px height=40px src="https://cdn-icons-png.flaticon.com/512/1945/1945940.png"> Articles
180188

@@ -203,6 +211,17 @@ All the translations for this repo will be listed below:
203211
---
204212

205213
## 4. Implicit, Explicit, Nominal, Structuring and Duck Typing
214+
The ECMAScript specification defines JavaScript as a dynamically typed language, meaning that types are associated with values rather than variables, and type checking occurs at runtime. There are various ways JavaScript manages types:
215+
216+
Implicit Typing (or Type Coercion): This occurs when JavaScript automatically converts one data type to another when required. For instance, JavaScript might convert a string to a number during an arithmetic operation. While this can simplify some code, it can also lead to unexpected results if not handled carefully.
217+
218+
Explicit Typing: Unlike implicit typing, explicit typing involves manually converting a value from one type to another using functions like Number(), String(), or Boolean().
219+
220+
Nominal Typing: JavaScript doesn't natively support nominal typing, where types are explicitly declared and checked. However, TypeScript, a superset of JavaScript, brings this feature to help catch type errors during development.
221+
222+
Structuring Typing: In this type system, types are based on the structure or properties of the data. JavaScript is a structurally typed language where objects are compatible if they share the same structure (i.e., the same set of properties and methods).
223+
224+
Duck Typing: This is a concept where an object's suitability is determined by the presence of certain properties and methods, rather than by the actual type of the object. JavaScript relies heavily on duck typing, where behavior is inferred from an object's properties rather than its declared type.
206225

207226
### <img align= center width=40px height=40px src="https://cdn-icons-png.flaticon.com/512/1945/1945940.png"> Articles
208227

@@ -230,6 +249,13 @@ All the translations for this repo will be listed below:
230249
---
231250

232251
## 5. == vs === vs typeof
252+
According to the ECMAScript specification, JavaScript includes both strict (===) and loose (==) equality operators, which behave differently when comparing values. Here's a breakdown:
253+
254+
== (Loose Equality): This operator performs type coercion before comparing two values. If the values are of different types, JavaScript will attempt to convert one or both values to a common type before comparison, which can lead to unexpected results.
255+
256+
=== (Strict Equality): This operator compares both the value and the type without any type coercion. If the two values are not of the same type, the comparison will return false.
257+
258+
typeof Operator: The typeof operator is used to check the data type of a variable. While it's generally reliable, there are certain quirks, like how typeof null returns "object" instead of "null", due to a long-standing behavior in JavaScript's implementation.
233259

234260
### <img align= center width=40px height=40px src="https://cdn-icons-png.flaticon.com/512/1945/1945940.png"> Articles
235261

@@ -258,6 +284,13 @@ All the translations for this repo will be listed below:
258284
---
259285

260286
## 6. Function Scope, Block Scope and Lexical Scope
287+
The ECMAScript specification outlines three key types of scope:
288+
289+
Function Scope: Variables declared within a function using var are only accessible within that function. This scope isolates variables from being accessed outside of the function where they are declared.
290+
291+
Block Scope: Introduced with ES6, variables declared with let and const are block-scoped. This means they are only accessible within the specific block {} in which they are defined, such as inside loops or conditionals.
292+
293+
Lexical Scope: Refers to how variable access is determined based on the physical location of the variables in the code. Functions are lexically scoped, meaning that they can access variables from their parent scope.
261294

262295
### Books
263296

@@ -300,6 +333,7 @@ All the translations for this repo will be listed below:
300333
---
301334

302335
## 7. Expression vs Statement
336+
According to the ECMAScript specification, expressions produce a value, and statements are instructions to perform an action, such as variable assignment or control flow. Function declarations are hoisted and can be called before they are defined in the code, while function expressions are not hoisted and must be defined before being invoked.
303337

304338
### <img align= center width=40px height=40px src="https://cdn-icons-png.flaticon.com/512/1945/1945940.png"> Articles
305339

@@ -330,7 +364,7 @@ All the translations for this repo will be listed below:
330364
---
331365

332366
## 8. IIFE, Modules and Namespaces
333-
367+
With the introduction of ES6 modules, the role of IIFEs in scope isolation has diminished but they still remain relevant.
334368
### Reference
335369

336370
- [IIFE — MDN](https://developer.mozilla.org/en-US/docs/Glossary/IIFE)
@@ -369,7 +403,7 @@ All the translations for this repo will be listed below:
369403
---
370404

371405
## 9. Message Queue and Event Loop
372-
406+
The Event Loop is a critical part of JavaScript’s concurrency model, ensuring non-blocking behavior by processing tasks in an asynchronous manner. Understanding how it interacts with the Message Queue and Microtasks is key to mastering JavaScript behavior.
373407
### <img align= center width=40px height=40px src="https://cdn-icons-png.flaticon.com/512/1945/1945940.png"> Articles
374408

375409
- [JavaScript Event Loop Explained — Anoop Raveendran](https://medium.com/front-end-hacking/javascript-event-loop-explained-4cd26af121d4)
@@ -422,6 +456,7 @@ All the translations for this repo will be listed below:
422456

423457
## 11. JavaScript Engines
424458

459+
425460
### <img align= center width=40px height=40px src="https://cdn-icons-png.flaticon.com/512/1945/1945940.png"> Articles
426461

427462
- [Is javascript compiled or interpreted language?](https://robiul.dev/is-javascript-compiled-or-interpreted-language)

0 commit comments

Comments
 (0)