I was reading through How to Make a Javascript Library and I came across a point where the author calls:
function _() {
//Some obects and variables and junk. . .
}
_.prototype = {
//some code. . .
myFunction: function() {
//Bla bla bla. . .
}
}
And I was wondering how this works, and what it does. I understand that it creates a command of _.myFunction()
but I don't understand how. I was wondering if it is the only way, and if it requires some other globals included somewhere.
Thanks in Advance!
Edit: experimenting with how this works, I have discovered the following:
function _$() {
//Bla bla bla. . .
}
_$.prototype {
myFunc: function(foo) {
return foo;
}
}
Then, when I call _$.myFunc
I get: Unkown Syntax error: myFunc is not a function
Just as Felix King said, it's not available. Could anyone tell me why, and how to make the function I set of myFunc
accessible with _$.myFunc(null);