HTML5 APPLICATIONS DEVELOPMENT MANUAL

(lu) #1

22 - Objects in JavaScript


An HTML element is an object, like a house or a car. Just as with real


life objects, we can access and modify HTML objects that appear on a screen.


The creation of interactive Web pages and apps relies on our ability to


manipulate objects on a screen. Objects are models of things in the real


world that were built using data. Objects are grouped into object models,


which are used to represent Browsers and Web pages.


In JavaScript, almost "everything" is an object.



  • Booleans can be objects (if defined with the new keyword)

  • Numbers can be objects (if defined with the new keyword)

  • Strings can be objects (if defined with the new keyword)

  • Dates are always objects

  • Maths are always objects

  • Regular expressions are always objects

  • Arrays are always objects

  • Functions are always objects

  • Objects are always objects


All JavaScript values, except primitives, are objects.

Free download pdf