3 Ways to Clone Objects in JavaScript | SamanthaMing.com

Great blog post explaining different ways for cloning objects in JavaScript. Also explains the difference between shallow and deep copy.

As you can see, the deep copy is a true copy for nested objects. Often time shallow copy is good enough, you don’t really need a deep copy. It’s like a nail gun vs a hammer. Most of the time the hammer is perfectly fine. Using a nail gun for some small arts and craft is often case an overkill, a hammer is just fine. It’s all about using the right tool for the right job

Source: 3 Ways to Clone Objects in JavaScript | SamanthaMing.com

Rxjs debugging subscribers

I wanted to see how many listeners there was for a certain subject, and where they reside in the source code.
Here is how in chrome devtools, put a breakpoint before the subjects .next() call. And inspect the subject:

observers array count = number of “listeners”
FunctionLocation = source code reference

(Context: Angular v11, rxjs)

Angular tips debugger – Pause Your Code With Breakpoints In Chrome DevTools

You can use this in Angular development for instance.
Just place till code on a line you wish to debug (e.g. in an component.ts file):

debugger;

Chrome will pause on that breakpoint.

Source: How To Pause Your Code With Breakpoints In Chrome DevTools

Leaflet – a JavaScript library for interactive maps

Leaflet is the leading open-source JavaScript library for mobile-friendly interactive maps. Weighing just about 38 KB of JS, it has all the mapping features most developers ever need.

Leaflet is designed with simplicityperformance and usability in mind. It works efficiently across all major desktop and mobile platforms, can be extended with lots of plugins, has a beautiful, easy to use and well-documented API and a simple, readable source code that is a joy to contribute to.

Source: Leaflet – a JavaScript library for interactive maps

Clean Code concepts adapted for JavaScript

Software engineering principles, from Robert C. Martin’s book Clean Code, adapted for JavaScript. This is not a style guide. It’s a guide to producing readable, reusable, and refactorable software in JavaScript.Not every principle herein has to be strictly followed, and even fewer will be universally agreed upon. These are guidelines and nothing more, but they are ones codified over many years of collective experience by the authors of Clean Code.

Source: ryanmcdermott/clean-code-javascript: Clean Code concepts adapted for JavaScript