Jquery function and prototype

by Rohan Kumar

JavaScript

;(function($){
    $.fn.foo = function(name,value){
           console.log(name,value);
    };
})(jQuery);
$(document).foo('bar','value');

var Foo = function() {};
Foo.prototype = {
    constructor: Foo,
    bar: function(arg){        
        console.log(arg);     // print 'undefined' here
    }
};
var f=new Foo();
f.bar('test');