- 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 Respuestas
+ 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! 👍