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());

9th Nov 2022, 2:01 PM
BOUTOUIL Ammar
BOUTOUIL Ammar - avatar
2 Antworten
+ 2
What is your question?
9th Nov 2022, 2:06 PM
Lisa
Lisa - avatar
+ 2
function print (){ console . log(this.name +": "+this.number) } print() should be like this
9th Nov 2022, 2:42 PM
Just Some Random Guy
Just Some Random Guy - avatar