0
Objects topic code project, JavaScript intermediate
Here it goes: I am designing a contact manager, the object constructor function is given with the property parameters given, but I am to add a code for a print() method that outputs on the console the given contact information, in the form of name: number, please, how do I go about it Here is the code: 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();
4 Réponses
+ 2
in the definition of contacts, you need to add a new method called print()
show your code attempt if you need help
0
My code attempt for the print method:
this.print = function (print) {
console.log(name: + number)
};
0
the method should NOT take any argument.
it should output this.name and this.number.
mind the ":" and the blank space
0
Chinonso Okorie
function is lowercase in javascript.
function contact
not
Function contact
just put your this.print definition inside your function body.