I am learning about creating objects in JavaScript. When I do this ...
var Person = {
name: "John Doe",
sayHi: function() {
alert("Hi");
}
};
I know that I am creating an instance of a Person class, but I do not know how (or if) I can reuse that class to create another instance. What OOP features does JavaScript has? Does it have the same OO features as other languages such as Java, or Ruby? Can someone please explain how JavaScript does OOP?
Personin you're example is a single object, not a class. Classes are usually defined as functions (that then get newed up). Try checking out mckoss.com/jscript/object.htm for an explanation of class inheritance, etc.