JavaScript’s Object Model
In JavaScript an object is a construct with properties that are variables or other objects. Functions associated with an object are known as the object’s methods. JavaScript includes some built-in objects and functions, but we can define our own as well.
Built-in Objects
samplestring = "Hello World"
The advantage of making a string into an object is that the object can have methods attached to it, as shown here:
JavaScript comes with a number of predefined objects. Like Java’s built-in classes, these objects make it easy to build some basic functions into a JavaScript program without having to do all the work yourself.
The first built-in object is the string object. Whenever you assign a string value to a variable or property, you’ve created a string object. An example is
will return "HELLO WORLD"