To pass an object as a parameter in JavaScript, use this and prototype. You can try to run the following code to learn how to pass an object −
Example
<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>