go back

JavaScript Clean APIs Part 1

Introduction

Do you want to write clean APIs like this.

const number = generateRandom();
const number2 = number1.addOne();
const number3 = number2.addOne();
const number4 = number3.addOne().addOne();

Admit it, this looks so clean. We are not writing APIs like

generateRandom().addOne().getNumber()

Let's see how we create such APIs.

Working demo

https://codepen.io/pritammukherjee16/pen/ZEpLVWq?editors=0010

#chrome #browser-api
Copyright © 2021 Bisvarup Mukherjee
counter freeViews