I was given print()method but I used function contact(name, number) { this.name = name; this.number = number; } va | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

I was given print()method but I used function contact(name, number) { this.name = name; this.number = number; } va

JavaScript contact manager

9th Dec 2020, 12:39 PM
devfemibadmus
devfemibadmus - avatar
5 Answers
+ 1
function contact(name, number) { this.name = name; this.number = number; this.print = function() { console.log(name +": " + number); } }
9th Dec 2020, 12:51 PM
Sudo
Sudo - avatar
+ 6
Full code please
9th Dec 2020, 12:49 PM
devfemibadmus
devfemibadmus - avatar
+ 5
Ok
9th Dec 2020, 12:51 PM
devfemibadmus
devfemibadmus - avatar
+ 3
Sky Lord, I know you have got a solution, I'm just reminding you to tag a relevant language name, rather than having 'is there any other way to solve it'. Up there please ... ☝
9th Dec 2020, 1:12 PM
Ipang
+ 2
print = function () { console.log(name+": "+number); } Add this inside contact function
9th Dec 2020, 12:42 PM
Sudo
Sudo - avatar