"So which way is better - object literal or constructor
function? Well, that depends on your specific task. For example, if
you need to create many different, yet similar objects, then the
class-like constructors may be the right choice. But if your object
is more of a one-off singleton, then object literal is definitely
simpler and shorter.
"OK then, so since there are no classes, how about inheritance?
functions are actually objects."
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.