The Complete Guide to ES10 Features
ES10 is no longer just a draft! All features have already been implemented in major browsers. Here is a non-alien guide for anyone interested in exploring ES10 (released June 2019.)
--
Here’s a list of my best web development tutorials.
Complete CSS flex tutorial on Hashnode.
Ultimate CSS grid tutorial on Hashnode.
Higher-order functions .map, .filter & .reduce on Hashnode.
You can follow me on Twitter to get tutorials, JavaScript tips, etc.
ES10 is not as significant as ES6 in terms of new features, but it does add several useful* things you might want to know about.
In ES6 arrow functions were hands down the most popular new feature.
What was it in ES10?
BigInt — Arbitrary precision integers
BigInt is the 7th primitive type.
BigInt is an arbitrary-precision integer. What this means is that variables can now represent 2⁵³ numbers. And not just max out at 9007199254740992.
const b = 1n; // append n to create a BigInt
In the past integer values greater than 9007199254740992
were not supported. If exceeded, the value would simply lock to MAX_SAFE_INTEGER + 1:
const limit = Number.MAX_SAFE_INTEGER;
⇨ 9007199254740991limit + 1;
⇨ 9007199254740992limit + 2;
⇨ 9007199254740992 <--- MAX_SAFE_INTEGER + 1 exceededconst larger = 9007199254740991n;
⇨ 9007199254740991nconst integer = BigInt(9007199254740991); // initialize with number
⇨ 9007199254740991nconst same = BigInt("9007199254740991"); // initialize with "string"
⇨ 9007199254740991n
typeof
typeof 10;
⇨ 'number'typeof 10n;
⇨ 'bigint'