0

Constructor shows undefined output ?

In contact manager app output is displayed but undefined is mentioned.

9th Dec 2020, 8:56 PM
Mehak Tufail
Mehak Tufail - avatar
4 Respuestas
0
Javascript
9th Dec 2020, 10:26 PM
Mehak Tufail
Mehak Tufail - avatar
0
function contact(name, number){ this.name = name; this.number = number; this.print =output; } var a = new contact("David", 12345); var b = new contact("Amy", 987654321); function output() { console.log(this.name, ":",this.number); //console.log(b.name,":",b.number); } console.log(a.print()); console.log(b.print());
9th Dec 2020, 10:27 PM
Mehak Tufail
Mehak Tufail - avatar