What is ESNext?

What is ESNext, actually? It varies depending on who’s using the term, usually “the next” version of ECMAScript (JavaScript). For instance, when I first wrote this answer in June 2019, if someone said “ESNext” they might be talking about ES2019 plus BigInt, dynamic import, and other features that had recently reached Stage 4 of the process, … Read more

JSLint says “missing radix parameter”

It always a good practice to pass radix with parseInt – For decimal – If the radix parameter is omitted, JavaScript assumes the following: If the string begins with “0x”, the radix is 16 (hexadecimal) If the string begins with “0”, the radix is 8 (octal). This feature is deprecated If the string begins with … Read more

What is the most efficient way to deep clone an object in JavaScript?

Native deep cloning It’s called “structured cloning”, works experimentally in Node 11 and later, and hopefully will land in browsers. See this answer for more details. Fast cloning with data loss – JSON.parse/stringify If you do not use Dates, functions, undefined, Infinity, RegExps, Maps, Sets, Blobs, FileLists, ImageDatas, sparse Arrays, Typed Arrays or other complex types within your object, a … Read more

What is the most efficient way to deep clone an object in JavaScript?

Native deep cloning It’s called “structured cloning”, works experimentally in Node 11 and later, and hopefully will land in browsers. See this answer for more details. Fast cloning with data loss – JSON.parse/stringify If you do not use Dates, functions, undefined, Infinity, RegExps, Maps, Sets, Blobs, FileLists, ImageDatas, sparse Arrays, Typed Arrays or other complex types within your object, a … Read more