0
Pls what is the mistake here I Javascript
function contact(name, number) { this.name = name; this.number = number; this.contactdata = print() function print(){ console.log(name + ": " + number) } } var a = new contact("David ", 12345); var b = new contact("Amy ", 987654321); a.print(); b.print();
1 Answer
+ 5
Elijah Adebanwo
You have created contactdata function not print function.
Function creation is wrong
this.print = function (){
console.log(this.name + ": " + this.number)