New course! Every coder should learn Generative AI!
Try a free lesson- 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 Answers
+ 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! ๐