0

Someone help me to find the problem?

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

17th May 2021, 6:35 PM
Ziadi mohamed sadek
Ziadi mohamed sadek - avatar
4 Réponses
+ 1
What's the problem? Completely working code.
17th May 2021, 6:47 PM
Solo
Solo - avatar
0
i don't now Because the result is ERROR
17th May 2021, 6:49 PM
Ziadi mohamed sadek
Ziadi mohamed sadek - avatar
0
I thing the problem in ":"
17th May 2021, 6:50 PM
Ziadi mohamed sadek
Ziadi mohamed sadek - avatar
0
What are you testing this code on? This works in SoloLearn. Because of ":" there can be no problems. The only thing that you did not do was put a punctuation mark at the end of the assignment to the variable "b".
17th May 2021, 7:03 PM
Solo
Solo - avatar