ऑब्जेक्ट्स की एक सरणी के गुणों तक पहुंचने के लिए, आप निम्न कोड चलाने का प्रयास कर सकते हैं -
उदाहरण
<html> <head> <title>User-defined objects</title> <script> function book(title, author){ this.title = title; this.author = author; } </script> </head> <body> <script> var myBook = new book("PHP", "Amit"); book.prototype.price = null; myBook.price = 250; document.write("Book title is : " + myBook.title + "<br>"); document.write("Book author is : " + myBook.author + "<br>"); document.write("Book price is : " + myBook.price + "<br>"); </script> </body> </html>
आउटपुट
Book title is : PHP Book author is : Amit Book price is : 250