Skip to content

Instantly share code, notes, and snippets.

View srsandy's full-sized avatar
👨‍💻
Learning everyday.

Sandeep「 Flame 」 srsandy

👨‍💻
Learning everyday.
View GitHub Profile
@srsandy
srsandy / eventEmitter.md
Last active May 23, 2018 13:16
Events in NodeJS

EventEmitter() in NodeJS 😄

EventEmitter is a class in NodeJS that helps to listen or fire events in your application. You can also keep track of events in you application.

Let's start with a simple eventEmitter example. First of all we need to add Event Object in our project

const events = require('events');
var eventEmitter = new events.EventEmitter();
@srsandy
srsandy / prototype.md
Last active June 19, 2018 14:39
PROTOTYPE in JAVASCRIPT

PROTOTYPE IN JS. 😄

By default every function has a property name as prototype which is EMPTY (by default). We can add properties and methods to it.

Note: Every function is a contructor function in JS.

Let's say we have an function x and create an object x of x as x1 will inherite the prototype of x.