It's giving problem.please help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

It's giving problem.please help

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() { 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();

7th Feb 2021, 6:18 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
5 Answers
+ 6
Sathe Prerana Satish I think there will be space after colon( : ) Check test cases output again
7th Feb 2021, 6:22 AM
A͢J
A͢J - avatar
+ 4
Please avoid posting duplicate questions https://www.sololearn.com/Discuss/2688959/?ref=app
7th Feb 2021, 6:24 AM
Ipang
+ 2
what's your problem? coz this code works as expected ^^
7th Feb 2021, 6:21 AM
visph
visph - avatar
0
Ok I'll try
7th Feb 2021, 6:23 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
0
Wait
7th Feb 2021, 6:23 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar