JavaScript is an Object Oriented language. It is a prototypical language, which means it handles inheritance by prototypes rather than classes. In JavaScript everything is an object or is automatically converted to one (except for null
and undefined
).
JavaScript has 5 primitive types (number
, boolean
, string
, null
and undefined
) that will automatically be wrapped into an object when methods are called on them, and then transformed back to primitive (except for null
and undefined
which does not have a wrapper objects):
"string".slice(2).replace("r", "k") === "king"; // true