要将对象作为参数传递给JavaScript,请使用this和prototype。您可以尝试运行以下代码以了解如何传递对象-
<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>