11. JavaScript: Objects

My object all sublime I shall achieve in time.

—W. S. Gilbert

Is it a world to hide virtues in?

—William Shakespeare

Objectives

In this chapter you’ll:

• Learn object-based programming terminology and concepts.

• Learn the concepts of encapsulation and data hiding.

• Learn the value of object orientation.

• Use the methods of the JavaScript objects Math, String, Date, Boolean and Number.

• Use HTML5 web storage to create a web application that stores user data locally.

• Represent objects simply using JSON.

Outline

11.1 Introduction

11.2 Math Object

11.3 String Object

11.3.1 Fundamentals of Characters and Strings

11.3.2 Methods of the String Object

11.3.3 Character-Processing Methods

11.3.4 Searching Methods

11.3.5 Splitting ...

Get Internet & World Wide Web: How to Program, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.