JavaScript

Fixing “node: –openssl-legacy-provider is not allowed in node_options” error

I recently ran into the "node: --openssl-legacy-provider is not allowed in node_options" error while working with Node 17. It occurs…

7 months ago

JavaScript: fix “SyntaxError: cannot use import statement outside a module”

I recently was working with a third-party library. I ran into the error "Uncaught SyntaxError: cannot use import statement outside…

7 months ago

How to sort a Set in JavaScript

ES6 introduced the set data structure in JavaScript. But sets are not ordered abstract data structures. So there is no…

1 year ago

Getting the value of an input element as a number without parseInt

Every once in a while, you come across something and you think, how did I not know this earlier? valueAsNumber is…

2 years ago

Deep copying in JavaScript using structuredClone

For as long as anyone can remember, deep copying in JavaScript was not a built-in feature and we had to…

2 years ago

Chrome devtools: Using logpoints for logging messages directly

When it comes to debugging JavaScript in Chrome devtools, there are two different camps: the console.log fans and the debugger/breakpoint…

2 years ago

How to prevent npm install for unsupported Node.js versions

npm configurations allow us to do quite a lot of nifty things. One of them is to allow the project…

2 years ago

Detecting dark mode preference using JavaScript

As dark themes have become popular across the web and across operating systems, we might want to check the user's…

2 years ago

JavaScript: Split string and keep the separators

String.prototype.split() is a valuable method to split strings based on a delimiter. There often comes a scenario when we want…

2 years ago

Printing JavaScript stack traces using console.trace

The console object in JavaScript has a lot more useful functions than the most frequently used console.log method. Debugging errors…

2 years ago
Advertisements