Variables vs values, primitives, functions, objects, and classes are values

Photo by the author, Spetses island

Sometimes the concept of a value is obvious like when dealing with numbers or strings. It is clear that numbers, strings, booleans are data and can be used as values.

Sometimes it is not so easier to understand. For example objects, functions and classes are values in JavaScript. …

Quick start with list components

Photo by the author, Hydra island

This article looks at how to manage a list of radio buttons vs a list of checkboxes with React Hooks.

In both cases, we need the list of options to display on the screen. Below is such a list.

const options = [
{ id: 1, name: "Option1" }…

Quick start with class expressions

Photo by the author, Lake Como

This article takes a look at how to create a class in a dynamic way using class expressions. This can be handy when creating simple classes used to build objects for transferring data.

Consider for example the next Todo class.

class Todo{
constructor(title, completed){
this.title = title;
this.completed …

API objects, stores, useState, useEffect, and more …

Photo by the author, Hydra island

A few years ago I wrote an article describing how to create a three-layer application using React. This post shows how to create the same architecture using React Hooks.

The there layers in question are :

  • The UI layer
  • The Business layer
  • The Data Access layer

All these layers will…

var, let, const, function, class, import, and more

Photo by the author, Neptun Romania

It is used to say that in JavaScript variables can be declared with var, let and const, but if you think about it, the function declaration, the class declaration, and the import statement are also ways to declare variables. This article looks at all of them.


var allows to declares…

useState, setTimeout, useEffect, useRef, and more

Photo by the author, Hydra island

This article looks at the challenge of reading the current state value inside a callback for setTimeout or setInterval utility functions.


Let’s start by creating a simple Counter component. It displays a counter and a button incrementing its value.

The state in this example is the counter value.

import {…

Get-up-to speed with the array includes method

Photo by the author

This short post looks at how to simplify an expression that tests several values using the includes array method.

Here is an example of how such logic may look like.

function checkCity(city){
if(city === "Sorento" || city === "Genova" || city == "Bari"){
return 1;

return 0;

The book is available in Kindle, paperback, and hardcover formats

Cover photo

The JavaScript: The Fundamentals book is now available in Kindle, paperback, and hardcover formats.

JavaScript is the language of the web and one of the most used programming languages.

It puts together some powerful features like closures, functions as values, objects as dynamic collections of properties, experimental characteristics, the prototype…

SELECT DISTINCT, TOP N, WHERE clause in SQL plus the filter, map, slice array methods, and more

Photo by the author

SQL stands for Structured Query Language. It can be used to store, update and retrieve data in a database. This article looks at basic SELECT statements retrieving data from a single table and discusses how to accomplish a similar behavior in JavaScript using the array methods.


In all examples, we…

Objects, arrays, sets, maps, and more

Photo by the author

JavaScript has several built-in data structures and in this article, we will look at how to convert between the most used of them: objects, arrays, sets, and maps.

Objects are collections of key-value pairs with a hidden property to their prototype.

Arrays are indexed collections of values.

Sets are collections…

Cristian Salcescu

Author of Functional Programming in JavaScript. Enthusiastic about sharing ideas.

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