Si, aunque poca gente lo sepa, JavaScript soporta algo parecido a la programación orientada a objetos.
Se pueden hacer clases, implementar jerarquias e incluso polimorfismo.
function Employee () {
this.name = "";
this.dept = "general";
}
function Manager () {
this.reports = [];
}
Manager.prototype = new Employee;
function WorkerBee () {
this.projects = [];
}
WorkerBee.prototype = new Employee;
extraido del mejor artículo que conozco (de Netscape):
Details of the Object Model
tal como el java mismo ;)
Posted by: mikel on Septiembre 3, 2003 02:47 AMNemo dat quod non habet - No one gives what he does not have
Rident stolidi verba Latina - Fools laugh at the Latin language. (Ovid)
A [golf] ball hitting a tree shall be deemed not to have hit the tree.
Hitting a tree is simply bad luck and has no place in a scientific game.
The player should estimate the distance the ball would have traveled if it
had not hit the tree and play the ball from there, preferably atop a nice
firm tuft of grass.
-- Donald A. Metz
lipitor
Mellita, domi adsum - Honey, I'm home
Materiam superabat opus - The workmanship was better than the subject matter. (Ovid)
Let's remind ourselves that last year's fresh idea is today's cliche.
-- Austen Briggs
buy cialis cheap cialisWhat if nothing exists and we're all in somebody's dream? Or what's worse,
what if only that fat guy in the third row exists?
-- Woody Allen, "Without Feathers"
d rcialis cialis onlineLet's remind ourselves that last year's fresh idea is today's cliche.
-- Austen Briggs
"The combination of a number of things to make existence worthwhile."
"Yes, the philosophy of 'none,' meaning 'all.'"
-- Spock and Lincoln, "The Savage Curtain", stardate 5906.4
buy cialis cheap cialistelepression, n.:
The deep-seated guilt which stems from knowing that you did not try
hard enough to look up the number on your own and instead put the
burden on the directory assistant.
n yo -- "Sniglets", Rich Hall & Friends
cialis cialis online "The combination of a number of things to make existence worthwhile."
"Yes, the philosophy of 'none,' meaning 'all.'"
-- Spock and Lincoln, "The Savage Curtain", stardate 5906.4