0
I created a contact object and added a print method to it.. the problem is I get an error code saying no input
This is what the code looks like function contact(name, number) { this.name = name; this.number = number; this.print = function() {this.name = name; this.number = number; console.log(name, number )} } var a = new contact("David", 12345); var b = new contact("Amy", 987654321); a.print(); b.print();
2 Respuestas
+ 1
Works fine for me
+ 1
There was silly mistake you done. I fixed it :)
function contact(name, number) {
this.name = name;
this.number = number;
this.print = function()
{this.name = name;
this.number = number;
console.log(name+": "+number )}
}
var a = new contact("David", 12345);
var b = new contact("Amy", 987654321);
a.print();
b.print();