0

How do i solve this? The code is below

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.

29th Sep 2021, 3:36 AM
Joel Sebastian Jijo
Joel Sebastian Jijo - avatar
6 ответов
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();
29th Sep 2021, 3:37 AM
Joel Sebastian Jijo
Joel Sebastian Jijo - avatar
+ 3
Nvm i got it now. Went throught the lesson a few more times.
30th Sep 2021, 12:45 PM
Joel Sebastian Jijo
Joel Sebastian Jijo - avatar
+ 2
Ok thnx for replying anyway.
29th Sep 2021, 4:48 AM
Joel Sebastian Jijo
Joel Sebastian Jijo - avatar
0
You haven't defined the print method.
29th Sep 2021, 4:36 AM
Simon Sauter
Simon Sauter - avatar
0
Thats the part confusing me i dont understand how to . Can u show how
29th Sep 2021, 4:41 AM
Joel Sebastian Jijo
Joel Sebastian Jijo - avatar
0
Sadly, no. I don't use js. But sooner or later someone will be around to explain it.
29th Sep 2021, 4:43 AM
Simon Sauter
Simon Sauter - avatar