0
Contact manager JavaScript
This is how I solved this problem with classes: class Contact{ constructor(name,number){ this.name = name; this.number = number; } print(){ const{name,number}=this; return`${name}: ${number}`; } } const a = new Contact("David", 12345); const b = new Contact("Amy", 987654321); console.log(a.print()); console.log(b.print());
2 Respostas
+ 2
What is your question?
+ 2
function print (){
console . log(this.name +": "+this.number)
}
print() should be like this