Tag javascript

Observer Design Pattern in JavaScript

The Observer Pattern is about a “one-to-many” relationship from one object called Subject (or publisher) to one or more objects called Listeners (or observers) that get notified when the Subject changes state. Therefore, several listeners could depend on one object to change for them to perform any action.
Svelte Logo

Svelte 3 Got My Attention

Svelte is different from a framework or a library in the sense that it is really a compiler that creates small components for your application. Those components are already optimized for the browser.

Queue Data Structure in JavaScript

It is easy to limit the functionality of an array to make it work as a particular queue or stack data structure. I personally believe that instead of using the array object directly, it is better to constrain it to the methods required by the job instead of leaving every method public that can be misused by other programmers.

Stack Data Structure in JavaScript

It's not difficult to simulate or implement the functionality of a stack by using arrays in JavaScript. By creating a Stack class, we can only use the methods required by the stack while hiding the methods that are not necessary.