I want to be able to do something like
var x = {};
x.something = function(y){
console.log(y);
};
x("hi"); // Call it without using .something
Is this possible? Any ideas?
I want to be able to do something like
var x = {};
x.something = function(y){
console.log(y);
};
x("hi"); // Call it without using .something
Is this possible? Any ideas?
Functions are objects, so you could do something like:
var x = function(y) {
console.log(y);
}
x.prop = function(){ return 'This works'; };
x('hi');
console.log(x.prop());