জাভাস্ক্রিপ্টে একটি বস্তুর বৈশিষ্ট্য এবং পদ্ধতি যোগ করতে, প্রোটোটাইপ ব্যবহার করুন সম্পত্তি।
উদাহরণ
প্রোটোটাইপের সাথে কীভাবে কাজ করবেন তা শিখতে আপনি নিম্নলিখিত কোডটি চালানোর চেষ্টা করতে পারেন −
<html>
<head>
<title>JavaScript prototype property</title>
<script>
function book(title, author) {
this.title = title;
this.author = author;
}
</script>
</head>
<body>
<script>
var myBook = new book("Amit", "Java");
book.prototype.price = null;
myBook.price = 500;
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>