जावास्क्रिप्ट में ऑब्जेक्ट को पैरामीटर के रूप में पास करने के लिए, this और प्रोटोटाइप का उपयोग करें। ऑब्जेक्ट पास करना सीखने के लिए निम्नलिखित कोड चलाएं:
उदाहरण
<html> <head> <script> var func = function(param1) { this.param1 = param1; }; func.prototype.display = function() { return this.param1; }; function display(val) { document.write(val()); } var res = new func(99); display(res.display.bind(res)); </script> </head> </html>