0

You are working on a Contact Manager app. You have created the contact object constructor, which has two arguments, name and nu

Help me

12th Jan 2021, 2:39 PM
Prabu S
Prabu S - avatar
21 Réponses
- 6
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();
13th Jan 2021, 9:04 AM
Motuncoded
Motuncoded - avatar
+ 7
Prabu S please show your attempt.
12th Jan 2021, 2:42 PM
Abhinav Raj
Abhinav Raj - avatar
+ 3
I'm not working on this App?
14th Jan 2021, 6:13 AM
Sonic
Sonic - avatar
+ 1
You are working on a Contact Manager app. You have created the contact object constructor, which has two arguments, name and number. You need to add a print() method to the object, which will output the contact data to the console in the following format: name: number The given code declares two objects and calls their print() methods. Complete the code by defining the print() method for the objects.
12th Jan 2021, 2:46 PM
Prabu S
Prabu S - avatar
+ 1
Spentify your code error showing in the output
13th Jan 2021, 6:33 AM
Prabu S
Prabu S - avatar
+ 1
Your code should be in this way
13th Jan 2021, 9:05 AM
Motuncoded
Motuncoded - avatar
+ 1
Rajesh here ans is 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();
21st Jul 2022, 8:46 PM
RAJESH ASTARKAR
RAJESH ASTARKAR - avatar
0
In java script
12th Jan 2021, 2:46 PM
Prabu S
Prabu S - avatar
0
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();
12th Jan 2021, 2:48 PM
Prabu S
Prabu S - avatar
0
I tried many times but I fail pls help me Spentify
12th Jan 2021, 3:14 PM
Prabu S
Prabu S - avatar
0
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(); Spentify
12th Jan 2021, 3:45 PM
Prabu S
Prabu S - 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();
15th Jan 2021, 4:51 PM
Kelvyn Eleazar De Oleo Taveras
Kelvyn Eleazar De Oleo Taveras - 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();
29th Apr 2022, 6:32 PM
Outman
0
need help please function contact(name, number) { this.name = name; this.number = number; this.print=print; function print(){ this.name+":"+this.number; } } var a = new contact("David", 12345); var b = new contact("Amy", 987654321); a.print(); b.print(); it doesnt give me an error but there is no output i get the same results with this function contact(name, number) { this.name = name; this.number = number; this.print=print; } function print(){ this.name+":"+this.number; } var a = new contact("David", 12345); var b = new contact("Amy", 987654321); a.print(); b.print(); this is too confusing
18th Jul 2022, 8:49 AM
Masa Vukcevic
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();
18th Aug 2022, 8:38 AM
Kavya Deshagani
Kavya Deshagani - avatar
0
function contact(name, number) { this.name = name; this.number = number; this.print =print2; } function print2 () { console.log(this.name + ": " + this.number); } var a = new contact("David", 12345); var b = new contact("Amy", 987654321) a.print(); b.print();
11th Sep 2022, 9:47 AM
César David Llanos Rodriguez
César David Llanos Rodriguez - 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();
19th Sep 2022, 11:57 PM
Mohamed Sawa
Mohamed Sawa - avatar
0
this.print = function (){ return console.log(`${this.name}: ${this.number}`);
26th Oct 2022, 1:55 AM
Marcos Soares
Marcos Soares - avatar
0
There's two ways of writing this and that is where people are getting confused. the first is written like so; function contact(name, number) { this.name = name; this.number = number; this.print = print; function print() { console.log(this.name+": "+this.number); } } var a = new contact("David", 12345); var b = new contact("Amy", 987654321); a.print(); b.print(); the second is written like so 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();
31st Dec 2023, 6:08 PM
Nicholas Miselo
Nicholas Miselo - avatar
12th Jan 2021, 2:48 PM
Prabu S
Prabu S - avatar