- 1
Contact Manager Project Help
I made a function for the objects that works fine, for some reason my string automatically places spaces when I donât think itâs supposed to. function contact(name, number) { this.name = name; this.number = number; this.print = function() { console.log(name,":", number) } } var a = new contact("David", 12345); var b = new contact("Amy", 987654321) a.print(); b.print(); For some reason the end result comes out with extra spaces like âDavid : 12345â when the answer to solve it is âDavid: 12345)â. I know the rule that if you add spaces to the string it adds them but I used none and they were added anyway.
5 Respostas
+ 4
Replace commas by + operator when logging to console đ
+ 3
Contact Manager Project is following
function contact(name, number) {
this.name = name;
this.number = number;
this.print = function() {
console.log(name+":", number)
}
}
var a = new contact("David", 12345);
var b = new contact("Amy", 987654321)
a.print();
b.print();
+ 2
thank you i didnt even know you could do that
+ 2
Mark thanks i was also stackđ
0
Good luck! đ