Javascript examples for Object:Private Member
private variable from a class
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w . j av a 2 s. co m*/ function Person(first,last,age) { this.firstname = first; this.lastname = last; this.age = age; this.bankBalance = 500; } // create your Person var john = new Person ('John','Doe',33); // try to print his bankBalance document.write (john.bankBalance); } </script> </head> <body> </body> </html>