You are working on a Contact Manager app. You have created the contact object constructor, which has two arguments, name and nu
18 Answers
New AnswerHelp me
1/12/2021 2:39:53 PM
Prabu S18 Answers
New AnswerExactly, that's the exercise. Now you gotta try yourself, and if you fail, share what you tried and I'll help you.
Hello Prabu S, We wont solve the coach problems for you, but we'll help you to find a solution yourself. Please share your try here first, then we can have a look at what's wrong. Thanks :)
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
Something like this: function contact(name, number) { this.name = name; this.number = number; print() { console.log(this.name + ": " + this.number); } } var a = new contact("David", 12345); var b = new contact("Amy", 987654321) a.print(); b.print();
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.
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();
Here: 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();
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();
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();
Learn Playing. Play Learning
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message