Sunday, May 17, 2015

Objects in JavaScript, Classes in Java

Coming from a Java background, it's easy to understand objects in Javascript.

A Javascript object with a constructor is like a class in Java.

Once you define an object with a constructor, it becomes like an object "type", or as a Java guy would say, a "class." Instances of this object/type/class may be instantiated with the "new" keyword, and their methods and properties can be accessed with dot notation.


No comments:

Post a Comment