কম্পিউটার টিউটোরিয়াল

জাভাস্ক্রিপ্ট getPrototypeOf() উদাহরণসহ


getPrototypeOf() মেথড ব্যবহারকারী তৈরি করা অবজেক্টের প্রোটোটাইপ চেক করতে ব্যবহৃত হয় এবং এটি প্রায়শই দুটি অবজেক্টের প্রোটোটাইপ একই কিনা তা তুলনা করার জন্য ব্যবহার করা হয়।

উদাহরণ

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> <style>    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 18px;       font-weight: 500;    } </style> </head> <body> <h1>JavaScript getPrototypeOf()</h1> <div class="sample"></div> <button class="Btn">CLICK HERE</button> <h3> Click on the above button to get the prototype of object test </h3> <script>    let sampleEle = document.querySelector(".sample");    function fun(name, age) {       this.name = name;       this.age = age;    }    document.querySelector(".Btn").addEventListener("click", () => {       let test = new fun("Rohan", 22);       sampleEle.innerHTML = "The prototype for test object is = " + Object.getPrototypeOf(test);    }); </script> </body> </html>

আউটপুট

জাভাস্ক্রিপ্ট getPrototypeOf() উদাহরণসহ

'CLICK HERE' বাটনে ক্লিক করলে -

জাভাস্ক্রিপ্ট getPrototypeOf() উদাহরণসহ


  1. জাভাস্ক্রিপ্টে JSON অবজেক্ট তৈরির পদ্ধতি? উদাহরণসহ ব্যাখ্যা

  2. জাভাস্ক্রিপ্টে অ্যাসিনক্রোনাস ফাংশন উদাহরণসহ ব্যাখ্যা

  3. জাভাস্ক্রিপ্টে ইনহেরিট্যান্স উদাহরণসহ

  4. জাভাস্ক্রিপ্টে ডিপ ক্লোনিং অবজেক্ট উদাহরণসহ ব্যাখ্যা