- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title></title>
- </head>
- <body>
- <script id="javascript">
- function personalDetail(fname,lname,email)
- {
- this.fname = fname;
- this.lname = lname;
- this.email = email;
- }
-
- var pDetail = new personalDetail("Akshay", "Patel", "[email protected]");
-
- var name = pDetail.fname + " " + pDetail.lname;
-
- alert(name);
- </script>
- </body>
- </html>
Member Function
Add following code snippet inside function at last.
- this.printDetail = function (detail)
- {
- alert(detail);
- }
Add following line of code at last inside script
- pDetail.printDetail(name + "\n" + pDetail.email);