- 2

Contact manager

My code isnā€™t running . code_ function contact(name, number) { this.name = name; this.number = number; } print() var a = new contact("David", 12345); var b = new contact("Amy", 987654321) a.print(); b.print();

17th Dec 2020, 11:42 AM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
11 Answers
+ 8
Emmanuel Osemudiamen function contact(name, number) { this.name = name; this.number = number; this.print = function () { console.log(`${this.name}: ${this.number}`) } } var a = new contact("David", 12345); var b = new contact("Amy", 987654321) a.print(); b.print();
18th Dec 2020, 4:25 AM
šŸ‡®šŸ‡³VivekšŸ‡®šŸ‡³
šŸ‡®šŸ‡³VivekšŸ‡®šŸ‡³ - avatar
+ 5
this.print = function () { return this. name + ": " this.number; }
17th Dec 2020, 12:10 PM
šŸ‡®šŸ‡³VivekšŸ‡®šŸ‡³
šŸ‡®šŸ‡³VivekšŸ‡®šŸ‡³ - avatar
+ 3
function contact(name, number) { this.name = name; this.number = number; } var a = new contact("David", 12345); var b = new contact("Amy", 987654321) a.print(); b.print(); this.print = function () { return this. name + ": " this.number; }
17th Dec 2020, 12:26 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
+ 1
vivek can you send the full solution on Words it didnt work bro
17th Dec 2020, 12:23 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
17th Dec 2020, 11:50 AM
Krish
Krish - avatar
0
function contact(name, number){ this.name=name; this.number=number; contact.prototype.print=function(){ console.log(this.name+" "+this.number) } } var a = new contact("David" , 12345); var b = new contact("Amy", 987654321); a.print(); b.print();
13th Mar 2021, 3:28 PM
Adediji Ayodele
Adediji Ayodele - avatar
0
function contact(name, number) { this.name = name; this.number = number; this.print = function () { console.log( this. name + ": " +this.number); } } var a = new contact("David", 12345); var b = new contact("Amy", 987654321); a.print(); b.print();
20th Jun 2021, 12:05 PM
Shodmon Mamayusupov
Shodmon Mamayusupov - avatar
0
function contact(name, number) { this.name = name; this.number = number; this.print = function() { return this.name+": "+this.number; } } var a = new contact("David", 12345); var b = new contact("Amy", 987654321); console.log(a.print()); console.log(b.print());
31st Oct 2021, 10:52 AM
Saurabh Chirde
Saurabh Chirde - avatar
0
function contact(name, number) { this.name = name; this.number = number; this.print = function(){ var x = this.name; var y = this.number; console.log(x + ": " + y); } } var a = new contact("David", 12345); var b = new contact("Amy", 987654321); a.print(); b.print();
15th Jun 2022, 9:55 AM
Shahad K
Shahad K - avatar
0
function contact(name, number) { this.name = name; this.number = number; this.print = both; } function both() { console.log(this.name +": "+ this.number); } var a = new contact("David", 12345); var b = new contact("Amy", 987654321); a.print(); b.print();
26th Sep 2022, 12:13 AM
Gamel Ayodele
Gamel Ayodele - avatar
- 1
function contact(name, number) { this.name = name; this.number = number; } var a = new contact("David", 12345); var b = new contact("Amy", 987654321); console.log(a.name + ":"+" " + a.number); console.log(b.name+ ":" + " " +b.number);
15th Mar 2021, 1:58 PM
SHUBHAM RAMESH NIMJE
SHUBHAM RAMESH NIMJE - avatar