Misty Autumn Forest
Misty Autumn Forest

This article is a result of some research I did around generating documentation for NodeJS/JavaScript based projects.

When using JSDoc to document JavaScript code with doc-strings, the next step is to get this information extracted and presented in a nice, friendly way. In any project, we also always have a README.md file with introductory descriptions and information. This main markdown file should serve as the front page of such a documentation UI.

Inside our README.md we could have made informative drawings to explain some control flow or architecture, written in the great mermaid language. We certainly want these drawings to…


Mushrooms

JavaScript is under the hood a rather different language than many other common programming languages, but it is perhaps not obvious at a first glance. With roots in the Lisp-like language Scheme — functions stand in the very center of how JavaScript operates. The function is in JS what is called a “first-rate citizen”, which means it can be assigned, returned and passed around like any other value.

All functions has always been “lambda functions” in JavaScript.

With the upgrades of the language that started in 2015, with ES6 and succeeding versions, the class syntax was added. Since it took…


Uncaught TypeError: Cannot read property ‘x’ of undefined

Recognize this? Seen this before? It is perhaps the most common error in Javascript.

Error prone dynamic data

We often deal with dynamic data in complex structures in all web applications (browser + node.js) which, when we try to use that data, might produce unexpected behaviors and errors.

Let’s look at a small example where we have a collection items (key indexed) of objects with certain properties. We need to get hold of an item's parent, and some properties from that parent item. It could look like this:

But this is a whole bunch of…


Javascript is really a great language when it comes to async programming. But it is not always a walk in the park to test async code.

It is a good idea in unit testing to try to test at the highest possible level — focusing on testing of the module’s API from an outside/usage perspective. That way, we ensure that it does what it should, but we don’t care exactly how — making refactoring of the module almost zero work when it comes to updating tests. However, this often increases the amount of async testing.

In cases where the calls…

Esbjörn Blomquist

Software architect and developer with web and functional JavaScript close to his heart. Worked many years with web solutions mainly within the IoT field.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store