- 1
Hi , please little help in code project contact manager
You are working on a Contact Manager app. You have created the contact object constructor, which has two arguments, name and number. You need to add a print() method to the object, which will output the contact data to the console in the following format: name: number The given code declares two objects and calls their print() methods. Complete the code by defining the print() method for the objects
11 Antworten
+ 2
Post your attempt also so that community can help you what u hace tried and wherr u facing problems
0
Thanks 😍
0
Akash Kumar don't give answer without OP had showed its attempt... and anyway, rather guide him than give him ready made solution without explanations ^^
0
This is the right answer
class contact {
constructor(name, number) {
this.name = name;
this.number = number;
}
print() {
console.log(`${this.name}: ${this.number}`);
}
}
var number1 = new contact("David", "12345");
var number2 = new contact("Amy", "987654321");
number1.print();
number2.print();
0
Akash Kumar even if that was too late, as OP as already seen your code ^^
Eman Ibrahim hassan don't be lazy and try by yourself: practice is the only way to learn ^^
however, if you stuck, post your try and we will guide you to complete by yourself ;)
0
visph I try but it doesn't work , really I will do the next time by myself
0
Eman Ibrahim hassan what happened with your code its working without any errors
0
A.S. that's not its code, he lazy had copy-pasted the code from Akash Kumar link (wich had deleted its answer but too late ^^)
0
0
visph all ready team of solo learn help you and write some code and complete them I just saw the right answer not copy it
- 1
A.S. yeah I complete the course thanks