Skip to content

Commit c67049c

Browse files
authored
Update README.md
1 parent 714af11 commit c67049c

File tree

1 file changed

+80
-4
lines changed

1 file changed

+80
-4
lines changed

README.md

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
465465

466466
**Note:** The spread syntax is opposite of rest parameter.
467467

468+
**[⬆ Back to Top](#table-of-contents)**
469+
468470
10. ### Iterators & For..of
469471

470472
String, Array, TypedArray, Map, and Set are all built-in iterables but objects are not iterables by default.
@@ -511,6 +513,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
511513

512514
**Note:** The abrupt iteration termination can be caused by break, throw or return.
513515

516+
**[⬆ Back to Top](#table-of-contents)**
517+
514518
11. ### Generators
515519
A generator is a function that can stop or suspend midway and then continue from where it stopped while maintaining the context(saved across re-entrances). It can be defined using a function keyword followed by an asterisk(i.e, function* ()).
516520

@@ -532,6 +536,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
532536

533537
**Note:** We can use `yield*` to delegate to another generator function
534538

539+
**[⬆ Back to Top](#table-of-contents)**
540+
535541
12. ### Modules
536542
Modules are small units of independent, reusable code to be used as the building blocks in a Javascript application.
537543

@@ -608,6 +614,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
608614
609615
```
610616

617+
**[⬆ Back to Top](#table-of-contents)**
618+
611619
13. ### Set
612620

613621
Set is a built-in object to store collections of unique values of any type.
@@ -625,6 +633,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
625633
console.log(mySet.has(2)); // true
626634
```
627635

636+
**[⬆ Back to Top](#table-of-contents)**
637+
628638
14. ### Weakset
629639

630640
The Set is used to store any type of data such as primitives and object types. Whereas WeakSet is an object to store weakly held objects in a collection. (i.e, WeakSet is the collections of objects only). Here weak means, If no other references to an object stored in the WeakSet exist, those objects can be garbage collected.
@@ -650,6 +660,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
650660
john = null;
651661
```
652662

663+
**[⬆ Back to Top](#table-of-contents)**
664+
653665
15. ### Map
654666

655667
Map is a collection of elements where each element is stored as a Key, value pair. It can hold both objects and primitive values as either key or value and iterates its elements in insertion order.
@@ -684,6 +696,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
684696
}
685697
```
686698
699+
**[⬆ Back to Top](#table-of-contents)**
700+
687701
16. ### Weakmap
688702
689703
WeakMap object is a collection of key/value pairs in which the keys are weakly referenced. For this object, the keys must be objects and the values can be arbitrary values.
@@ -710,6 +724,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
710724
console.log(weakMap.get(obj1)); //undefined
711725
```
712726

727+
**[⬆ Back to Top](#table-of-contents)**
728+
713729
17. ### Unicode
714730

715731
Prior to ES6, JavaScript strings are represented by 16-bit character encoding (UTF-16). Each character is represented by 16-bit sequence known as code unit. Since the character set is been expanded by Unicode, you will get unexpected results from UTF-16 encoded strings containing surrogate pairs(i.e, Since it is not sufficient to represent certain characters in just 16-bits, you need two 16-bit code units).
@@ -748,6 +764,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
748764
console.log(String.fromCodePoint(134071)); // "𠮷"
749765
```
750766

767+
**[⬆ Back to Top](#table-of-contents)**
768+
751769
18. ### Symbols
752770

753771
Symbol is a new peculiar primitive data type of JavaScript, along with other primitive types such as string, number, boolean, null and undefined. The new symbol is created just by calling the Symbol function. i.e, Every time you call the Symbol function, you’ll get a new and completely unique value. You can also pass a parameter to Symbol(), which is useful for debugging purpose only.
@@ -790,6 +808,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
790808
console.log(Symbol.for('foo') === Symbol.for('foo')); // true
791809
```
792810

811+
**[⬆ Back to Top](#table-of-contents)**
812+
793813
19. ### Proxies
794814
The Proxy object is used to create a proxy for another object, which can intercept and redefine fundamental operations for that object such as property lookup, assignment, enumeration, function invocation etc. These are used in many libraries and some browser frameworks.
795815

@@ -852,6 +872,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
852872
person.age = 200; // Throws an exception
853873
```
854874
875+
**[⬆ Back to Top](#table-of-contents)**
876+
855877
20. ### Promises
856878
857879
A promise is an object which represent the eventual completion or failure of an asynchronous operation.
@@ -893,6 +915,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
893915
});
894916
```
895917
918+
**[⬆ Back to Top](#table-of-contents)**
919+
896920
21. ### Reflect
897921
898922
Reflection is the ability of a code to inspect and manipulate variables, properties, and methods of objects at runtime. JavaScript already provides `Object.keys(), Object.getOwnPropertyDescriptor(), and Array.isArray()` methods as classic refection features. In ES6, it has been officially provided through Reflect object. Reflect is a new global object which is used to call methods, construct objects, get and set properties, manipulate and extend properties.
@@ -1017,6 +1041,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
10171041
10181042
6. **:**
10191043
1044+
**[⬆ Back to Top](#table-of-contents)**
1045+
10201046
22. ### Binary and Octal
10211047
ES5 provided numeric literals in octal (prefix 0), decimal (no prefix), and hexadecimal ( 0x) representation. ES6 added support for binary literals and improvements on octal literals.
10221048
@@ -1065,6 +1091,7 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
10651091
console.log(invalidNum); // SyntaxError
10661092
```
10671093
1094+
**[⬆ Back to Top](#table-of-contents)**
10681095
10691096
23. ### Proper Tail Calls
10701097
@@ -1103,6 +1130,9 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
11031130
console.log(factorial(1000));
11041131
console.log(factorial(10000));
11051132
```
1133+
1134+
**[⬆ Back to Top](#table-of-contents)**
1135+
11061136
24. ### Array find methods
11071137
ES6 introduced few array methods and two of them are `Array.find()` and `Array.findIndex()`.
11081138
@@ -1168,6 +1198,9 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
11681198
console.log(numbers.includes(NaN)); // true
11691199
console.log(numbers.includes(undefined)); // true
11701200
```
1201+
1202+
**[⬆ Back to Top](#table-of-contents)**
1203+
11711204
2. ### Exponentiation Operator
11721205
11731206
The older versions of javascript uses `Math.pow` function to find the exponentiation of given numbers. ECMAScript 2016 introduced the exponentiation operator, **(similar to other languages such as Python or F#) to calculate the power computation in a clear representation using infix notation.
@@ -1213,6 +1246,9 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
12131246
}
12141247
logger();
12151248
```
1249+
1250+
**[⬆ Back to Top](#table-of-contents)**
1251+
12161252
2. ### Object values
12171253
Similar to Object.keys which iterate over JavaScript object’s keys, Object.values will do the same thing on values. i.e, The Object.values() method is introduced to returns an array of a given object's own enumerable property values in the same order as `for...in` loop.
12181254
@@ -1230,7 +1266,9 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
12301266
console.log(Object.values(['India', 'Singapore'])); // ['India', 'Singapore']
12311267
console.log(Object.values('India')); // ['I', 'n', 'd', 'i', 'a']
12321268
```
1233-
1269+
1270+
**[⬆ Back to Top](#table-of-contents)**
1271+
12341272
3. ### Object entries
12351273
The `Object.entries()` method is introduced to returns an array of a given object's own enumerable string-keyed property [key, value] pairsin the same order as `for...in` loop.
12361274
```js
@@ -1250,7 +1288,9 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
12501288

12511289
console.log(Object.entries(100)); // [], an empty array for any primitive type because it won't have any own properties
12521290
```
1253-
1291+
1292+
**[⬆ Back to Top](#table-of-contents)**
1293+
12541294
4. ### Object property descriptors
12551295
12561296
Property descriptors describe the attributes of a property. The `Object.getOwnPropertyDescriptors()` method returns all own property descriptors of a given object.
@@ -1274,6 +1314,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
12741314
const descriptors = Object.getOwnPropertyDescriptors(profile);
12751315
console.log(descriptors); // {age: {configurable: true, enumerable: true, writable: true }}
12761316
```
1317+
1318+
**[⬆ Back to Top](#table-of-contents)**
12771319
12781320
5. ### String padding
12791321
Some strings and numbers(money, date, timers etc) need to be represented in a particular format. Both `padStart() & padEnd()` methods introduced to pad a string with another string until the resulting string reaches the supplied length.
@@ -1302,6 +1344,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
13021344
console.log(label2 + ": " + value2); // Name: John
13031345
// Phone Number: (222)-333-3456
13041346
```
1347+
1348+
**[⬆ Back to Top](#table-of-contents)**
13051349
13061350
6. ### Shared memory and atomics
13071351
The Atomics is a global object which provides atomic operations to be performed as static methods. They are used with SharedArrayBuffer(fixed-length binary data buffer) objects. The main use cases of these methods are,
@@ -1405,6 +1449,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
14051449
14061450
In order to access asynchronous data sources, ES2018 introduced the AsyncIterator interface, an asynchronous iteration statement (for-await-of), and async generator functions.
14071451
1452+
**[⬆ Back to Top](#table-of-contents)**
1453+
14081454
2. ### Object rest and spread operators
14091455
14101456
ES2015 or ES6 introduced both rest parameters and spread operators to convert arguments to array and vice versa using three-dot(...) notation.
@@ -1446,6 +1492,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
14461492
const myObject = { a: 1, b: 2, c: 3, d:4 };
14471493
const myNewObject = { ...myObject, e: 5 }; // { a: 1, b: 2, c: 3, d: 4, e: 5 }
14481494
```
1495+
1496+
**[⬆ Back to Top](#table-of-contents)**
14491497
14501498
3. ### Promise finally
14511499
@@ -1513,6 +1561,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
15131561

15141562
console.log(numberArray1.flatMap(value => [value * 10])); // [10, 20, 30, 40, 50]
15151563
```
1564+
1565+
**[⬆ Back to Top](#table-of-contents)**
15161566
15171567
2. ### Object fromEntries
15181568
@@ -1551,6 +1601,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
15511601

15521602
Object.fromEntries(searchParams); // => {param1: "foo", param2: "baz"}
15531603
```
1604+
1605+
**[⬆ Back to Top](#table-of-contents)**
15541606
15551607
3. ### String trimStart and trimEnd
15561608
In order to make consistency with padStart/padEnd, ES2019 provided the standard functions named as `trimStart` and `trimEnd` to trim white spaces on the beginning and ending of a string. However for web compatilibity(avoid any breakage) `trimLeft` and `trimRight` will be an alias for `trimStart` and `trimEnd` respectively.
@@ -1567,6 +1619,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
15671619
console.log(messageTwo.trimStart()); //Hello World!!
15681620
console.log(messageTwo.trimEnd()); // Hello World!!
15691621
```
1622+
1623+
**[⬆ Back to Top](#table-of-contents)**
15701624
15711625
4. ### Symbol description
15721626
@@ -1585,6 +1639,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
15851639

15861640
console.log(Symbol.iterator.description); // "Symbol.iterator"
15871641
```
1642+
1643+
**[⬆ Back to Top](#table-of-contents)**
15881644
15891645
5. ### Optional catch binding
15901646
Prior to ES9, if you don't need `error` variable and omit the same variable then catch() clause won't be invoked. Also, the linters complain about unused variables. Inorder to avoid this problem, the optional catch binding feature is introduced to make the binding parameter optional in the catch clause. If you want to completely ignore the error or you already know the error but you just want to react to that the this feature is going to be useful.
@@ -1613,6 +1669,9 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
16131669
}
16141670
} catch (unused) {}
16151671
```
1672+
1673+
**[⬆ Back to Top](#table-of-contents)**
1674+
16161675
6. ### JSON Improvements
16171676
16181677
JSON is used as a lightweight format for data interchange(to read and parse). The usage of JSON has been improved as part of ECMAScript specification. Basically there are 2 important changes related to JSON.
@@ -1644,6 +1703,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
16441703
```js
16451704
console.log(JSON.stringify("\uD800")); // '"\ud800"'
16461705
```
1706+
1707+
**[⬆ Back to Top](#table-of-contents)**
16471708
16481709
7. ### Array Stable Sort
16491710
The sort method for arrays is stable in ES2020. i.e, If you have an array of objects and sort them on a given key, the elements in the list will retain their position relative to the other objects with the same key.​
@@ -1666,6 +1727,7 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
16661727
]
16671728
users.sort((a, b) => a.age - b.age);
16681729
```
1730+
**[⬆ Back to Top](#table-of-contents)**
16691731
16701732
8. ### Function.toString()
16711733
Functions have an instance method called `toString()` which return a string to represent the function code. Previous versions of ECMAScript removes white spaces,new lines and comments from the function code but it has been retained with original source code in ES2020.
@@ -1684,6 +1746,8 @@ Each proposal for an ECMAScript feature goes through the following maturity stag
16841746
// console.log(`Hello, ${msg}`);
16851747
// }
16861748
```
1749+
1750+
**[⬆ Back to Top](#table-of-contents)**
16871751
16881752
9. ### Private Class Variables
16891753
In ES6, the classes are introduced to create reusable modules and variables are declared in clousure to make them private. Where as in ES2020, private class variables are introduced to allow the variables used in the class only. By just adding a simple hash symbol in front of our variable or function, you can reserve them entirely for internal to the class.
@@ -1747,6 +1811,8 @@ Most of these features already supported by some browsers and try out with babel
17471811
console.log(1n == 1); // true
17481812
```
17491813
1814+
**[⬆ Back to Top](#table-of-contents)**
1815+
17501816
2. ### Dynamic Import
17511817
Static imports supports some of the important use cases such as static analysis, bundling tools, and tree shaking, it is also it's desirable to be able to dynamically load parts of a JavaScript application at runtime.
17521818
@@ -1784,6 +1850,8 @@ Most of these features already supported by some browsers and try out with babel
17841850
17851851
**Note:** Dynamic import does not require scripts of `type="module"`
17861852
1853+
**[⬆ Back to Top](#table-of-contents)**
1854+
17871855
3. ### Nullish Coalescing Operator
17881856
The nullish coalescing operator (??) is a logical operator that returns its right-hand side operand when its left-hand side operand is `null` or `undefined`, and otherwise returns its left-hand side operand. This operator replaces `||` operator to provide default values if you treat empty value or '', 0 and NaN as valid values. This is because the logical OR(||) operator treats(empty value or '', 0 and NaN) as falsy values and returns the right operand value which is wrong in this case. Hence, this operator truely checks for `nullish` values instead `falsy` values.
17891857
```js
@@ -1801,6 +1869,8 @@ Most of these features already supported by some browsers and try out with babel
18011869
console.log(vehicle.car.speed ?? 90); // 0(zero is valid case for speed)
18021870
```
18031871
In a short note, nullish operator returns a non-nullish value and || operator returns truthy values.
1872+
1873+
**[⬆ Back to Top](#table-of-contents)**
18041874
18051875
4. ### String matchAll
18061876
@@ -1818,6 +1888,8 @@ Most of these features already supported by some browsers and try out with babel
18181888
["test1", "e", "st1", "1", index: 0, input: "test1test2", groups: undefined]
18191889
["test2", "e", "st2", "2", index: 5, input: "test1test2", groups: undefined]
18201890
```
1891+
1892+
**[⬆ Back to Top](#table-of-contents)**
18211893
18221894
5. ### Optional chaining
18231895
@@ -1847,8 +1919,10 @@ Most of these features already supported by some browsers and try out with babel
18471919
console.log(vehicle.car?.name ?? "Unknown"); // Unknown
18481920
console.log(vehicle.car?.speed ?? 90); // 90
18491921
```
1922+
1923+
**[⬆ Back to Top](#table-of-contents)**
18501924
1851-
5. ### Promise.allSettled
1925+
6. ### Promise.allSettled
18521926
18531927
It is really helpful to log(especially to debug errors) about each promise when you are handling multiple promises. The `Promise.allSettled()` method returns a new promise that resolves after all of the given promises have either fulfilled or rejected, with an array of objects describing the outcome of each promise.
18541928
```js
@@ -1863,7 +1937,9 @@ Most of these features already supported by some browsers and try out with babel
18631937
```
18641938
As per the output, each outcome object returns `status` field which denotes either "fulfilled"(value present) or "rejected"(reason present)
18651939
1866-
6. ### globalThis
1940+
**[⬆ Back to Top](#table-of-contents)**
1941+
1942+
7. ### globalThis
18671943
Prior to ES2020, you need to write different syntax in different JavaScript environments(cross-platforms) just to access the global object. It is really a hard time for developers because you need to use `window, self, or frames` on the browser side, `global` on the nodejs, `self` on the web workers side.
18681944
18691945
On the other hand, `this` keyword can be used inside functions for non-strict mode but it gives undefined in strict mode. If you think about `Function('return this')()` as a solution for above environments, it will fail for CSP enabled environments(where eval() is disabled).

0 commit comments

Comments
 (0)