Can someone please help with the print method | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone please help with the print method

I can’t seem to get the the print output to print the new arguments 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();

15th Mar 2023, 1:45 PM
Arosanyin Daniel
Arosanyin Daniel - avatar
4 Answers
+ 1
Yasin Rahnaward Please don't give ready-made code. Rather help the OP find their own solution.
15th Mar 2023, 3:52 PM
Lisa
Lisa - avatar
+ 2
Arosanyin Daniel use:- console.log(a); console log(b);
15th Mar 2023, 2:14 PM
Sakshi
Sakshi - avatar
+ 2
Arosanyin Daniel Lisa 😊 //code project (contact number) intermediate //Javascript //you need to add the print method inside the // contact function (here it play the role of class). // it is going to work as I wrote it down. function contact(name, number) { this.name = name; this.number = number; // add this print function to your code😎😊😊👇 this.print =function(){ console.log(this.name+": "+this.number) }} // ☝️☝️☝️ var a = new contact("David", 12345); var b = new contact("Amy", 987654321); a.print(); b.print(); https://www.sololearn.com/discuss/3197455/?ref=app
15th Mar 2023, 3:21 PM
Yasin Rahnaward
Yasin Rahnaward - avatar
0
You did not write any print() method. The task is to write a print() method for contact.
15th Mar 2023, 2:10 PM
Lisa
Lisa - avatar