Higher-Order Functions in Javascript

Functions are a fundamental building block of JavaScript. They can be used to perform calculations, manipulate data, and control the flow of execution. In JavaScript, functions are also first-class citizens, which means that they can be treated like any other value. First-class citizen in a programming language means that an entity (such as a function) has the same properties and abilities as other entities. This means that functions can be:…

Promises In Javascript

Promises In Javascript In this guide, we’ll learn the basics of what a Promise is in Javascript, the why, and how you can use them. Table of content What is a Promise in Javascript First of all, do not overthink the meaning of the term Promise it’s exactly the same promise you know. You know how your mom promises to get you a new cartoon series if you come out with the…

Use Rust in a Node.js project

Rust is the most loved language right now — sounds like a cliche already 😃, but it’s true. In fact, it has been added to the Linux Kernel and going to be added to the Windows Kernel. Not every language enjoys that kind of privilege and love, you know. One of the benefits of Rust is that it’s fast, if you have implemented something awesome in Rust and you want…

Node.js: boost perf with worker threads

Node.js is a powerful and efficient tool. However, because it is single threaded we might have issues when working with CPU-intensive operations. For example, when you try to upload large JSON or media files. This operation will most likely block the main thread and every other operation will have to wait until it’s completed. First off, what is a worker thread in Node.js? A worker thread is a sequence of instructions within…

Streaming a Video with Node.js

Streaming is the process of consuming data continuously in part without downloading the entire file at once to your device and then using it afterward. Think of YouTube, Netflix, and Amazon Prime, these platforms allow you to watch videos without first downloading the entire video to your device. Imagine having to download all the videos you see on social media before watching them. That will be so much work, a…

Process.nextTick, the event loop invader

process.nextTick() is that tough customer that gets in a bank queue and says to the banker, attend to me after the current customer you are attending to, regardless of whether it’s my turn or not.  Rude, right? While trying to understand the fundamentals of Javascript & NodeJS, the event loop is usually one of the crucial concepts you’ll come across. The event loop allows Node.js to perform non-blocking I/O operations…