JAVA SCRIPT DESIGN PATTERNS
The Observer pattern provides a way to notify multiple subscribers on single event

Observer Pattern
The observer pattern is a software design pattern in which an object, named the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods
Lets say we run a ecommerce
Lets say when some one puts an order on our website we want to perform certain actions like notify the supplier , notify the customer thorugh email and sms
Event : When someone puts the order
Subscribers : 1. notify supplier 2. Send customer email 3. send customer sms
JAVA SCRIPT DESIGN PATTERNS
The Proxy pattern provides a proxy (duplicate ) object for another object and controls access to this other object

let see it by an example
lets say we have a user object like below
const user = {
userName:"neerajdana",
email:"neerajdana9@gmail.com",
age:32
}
now lets say we want to apply some constrains or validations when someone modify the object values as follows
- The username length should be min 4 and max 10
- The userName should always be saved in lower Case
- The email should be proper email
- The age should be number
But right now we can set the values directly and no one will stop us from doing so
This is where proxy pattern comes handy
so rather then exposing the subject (user object) directly we will create a proxy object and then expose that proxy object lets see it
NATURAL LANGUAGE PROCESSING

This article is in continuation to earlier article please read that to follow along here
So earlier we have seen how we can calculate the tf-idf of the words in plain javascript . in this article we will see how we can use tfidf to classify the reviews as positive or negative by technique called Naive Bayes