+ 1
Need help with print method from contact manager challenge
I hope you can give me a hint so I can figure this out because until this point I have not seen anything like a.print or b.print and the previous lessons don't have any examples about this. I'm supposed to define two print methods for the object a.print and b.print. function contact(name, number) { this.name = name; this.number = number; } var a = new contact("David", 12345); var b = new contact("Amy", 987654321); a.print(); b.print();
6 Respostas
+ 3
Add
this.print = function contact(){
console.log(this.name+this.number)}
+ 1
ubai node.js
+ 1
function contact(name,number){
this.name=name;
this.number=number;
this.print=function(){
console.log(this.name+" : "+this.number);
}
}
let a=new contact("jasy",21332);
let b=new contact("fabiano",86873);
a.print();
b.print();
0
JavaScript does not have any print object or print methods.
0
Thank you
0
Thanks Fabiano. I think I saw the keyword "let" way back when I was studying the Basic programming language, but I have not seen it here within Javascript so if this "let" keyword is required for this challenge, then it's strange that I was not introduced to it in previous lessons.