Skip to content

Instantly share code, notes, and snippets.

View DronRathore's full-sized avatar

Dron Rathore DronRathore

View GitHub Profile
@DronRathore
DronRathore / call_apply.js
Last active August 29, 2015 14:14
Call vs Apply
var classA = function(options){
if (this instanceof classA){
this.options = options;
return this
} else {
return new classA(options)
}
}
classA.prototype.someAsnyc = function(callback, flag){
@DronRathore
DronRathore / anonymous.js
Created September 18, 2014 14:31
Node Anonymous Function Vs Named Functions
var globalTime = new Date().getTime();
var b = function(callback){
var date = new Date().getTime();
for (var i=0;i<10000;i++)
callback();
console.log("Completed a function test in", new Date().getTime()-date);
}
b(function(){
var date = new Date().getTime();
//console.log("Started A at:", date-globalTime);