+ 1
Contact Manager(JS). What's wrong with my code
function contact(name, number) { this.name = name; this.number = number; this.print = print() } function print() { document.write(a.name":"b.number); } var a = new contact("David", 12345); var b = new contact("Amy", print ) a.print(); b.print();
2 Respostas
+ 5
Augustine Ansah Owusu
There should be space after the colon (:) and also a & b is not accessible in the function print()
function contact (name, number) {
this.print = function () {
console.log(name + ": " + number);
}
}
+ 1
I Am Groot Thank you that help