Skip navigation

Monthly Archives: May 2013


Happen to see this nice cool JavaScript code somewhere in web.

// 
function is(it) { 
   alert(this+" is " +it);
}
is("global");  // [object Window] is global
is.call(5,"number");  // 5 is number
is.apply("A", ['string']);  // A is string
alert.is=is;  
alert.is("function");  // function alert() { [native code] } is function
// 

is it JavaScript? its upto you to call or apply.

Hope JavaScript folks enjoy this.