Javascript contact Manager Module Project | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Javascript contact Manager Module Project

I don't understand why my code isn't working. I tried it on my computer and the output works but in the app it doesn't work šŸ”¹šŸ”¹šŸ”¹šŸ”¹šŸ”¹ ā“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; this.print = function () { this.output = this.name + ":" + this.number; } } var a = new contact("David", 12345); var b = new contact("Amy", 987654321) a.print(); b.print();

17th Feb 2021, 1:10 PM
Brenda Michelle šŸŒæ
Brenda Michelle šŸŒæ - avatar
5 Respostas
+ 3
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(); Here is my code. You can try it. Happy coding šŸ‘
18th Feb 2021, 1:59 AM
ā¤ļøšŸ˜PreranašŸ˜ā¤ļø
ā¤ļøšŸ˜PreranašŸ˜ā¤ļø - avatar
+ 3
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();
23rd Apr 2021, 7:28 AM
Aryan Anand
Aryan Anand - avatar
0
Spentify thank you! šŸ˜ŠšŸ‘
17th Feb 2021, 1:23 PM
Brenda Michelle šŸŒæ
Brenda Michelle šŸŒæ - avatar
0
function contact(name, number) { this.name = name; this.number = number; this.print = function () { console.log(name+": "+ number); } } var a = new contact("David", 12345); var b = new contact("Amy", 987654321); a.print(); b.print();
15th Aug 2021, 12:34 AM
Yodit Alemayehu
Yodit Alemayehu - avatar
0
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(); Note: there must be a space after the colon (:). This ": " Space in the string. Not ":" No space in string. This will solve the project, but try both to see how it works. Happy coding!
25th Aug 2021, 9:55 AM
Courage Asraku
Courage Asraku - avatar