0

Why am I getting "no input" on Contact Manager task?

I'm working on the Contact Manager code and at this point, I'm getting the right output but no input and it tells me to try again. This is my code so far. Can someone help understand what I'm doing wrong? function contact(name, number) { this.name = name; this.number = number; this.print =function(name, number){ 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()

2nd Apr 2022, 9:52 PM
Jack Ori
2 Réponses
+ 1
I tested your code in code playground and it give output, probably problem is with test, here is working code. function contact(name, number) { this.name = name; this.number = number; // you can access this.name and this.number inside method, so no need to add it as parameter this.print = function() { // it is important to have space after ":" it also show no input in test case if it is left without space so ": " not ":" wird problem console.log (this.name + ": " + this.number); } } var a = new contact("David", 12345); var b = new contact("Amy", 987654321); a.print(); b.print();
2nd Apr 2022, 10:03 PM
PanicS
PanicS - avatar
+ 1
Thank you! I knew it had to be something simple but I couldn't figure out what. Solved now.
2nd Apr 2022, 10:20 PM
Jack Ori