Quantcast
Channel: w3mentor » Javascript
Viewing all articles
Browse latest Browse all 100

Example of Encapsulation using JavaScript

$
0
0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>JavaScript - Encapsulation Exercise</title> </head>   <body> <p> <script language="JavaScript" type="text/JavaScript">   // ************************************************************************ // CREATE AN AUTOMOBILE USING A CONSTRUCTOR // ************************************************************************ function Automobile(speed) {   // ************************************************************************ // PUBLIC PROPERTY -- ANYONE MAY READ/WRITE // ************************************************************************ this.model = "Standard";   // ************************************************************************ // PRIVATE […]
Continue reading...

Viewing all articles
Browse latest Browse all 100

Trending Articles