Sololearn javascript менеджер контактов

Javascript contact Manager Module Project

I don’t understand why my code isn’t working. I tried it on my computer and the output works but in the app it doesn’t work 🔹🔹🔹🔹🔹 ❓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. 🔻🔻🔻🔻🔻 function contact(name, number) < this.name = name; this.number = number; this.print = function () < this.output = this.name + ":" + this.number; >> var a = new contact(«David», 12345); var b = new contact(«Amy», 987654321) a.print(); b.print();

function contact(name, number) < this.name = name; this.number = number; 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(); Here is my code. You can try it. Happy coding 👍

function contact(name, number) < this.name = name; this.number = number; this.print = function () < console.log(name+": "+ number); >> var a = new contact(«David», 12345); var b = new contact(«Amy», 987654321); a.print(); b.print();

function contact(name, number) < this.name = name; this.number = number; this.print = print; >function print() < console.log(this.name + ": " + this.number); >var a = new contact(«David», 12345); var b = new contact(«Amy», 987654321); a.print(); b.print(); Note: there must be a space after the colon (:). This «: » Space in the string. Not «:» No space in string. This will solve the project, but try both to see how it works. Happy coding!

Читайте также:  Графики в консоли python

Often have questions like this?

Learn more efficiently, for free:

Источник

JavaScript Contact manager help.

please help me to solve it.. 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. code__ function contact(name, number) < this.name = name; this.number = number; >print() var a = new contact(«David», 12345); var b = new contact(«Amy», 987654321) a.print(); b.print();

please help me to solve it.. 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. code__ function contact(name, number) < this.name = name; this.number = number; >print() var a = new contact(«David», 12345); var b = new contact(«Amy», 987654321) a.print(); b.print();

function contact(name, number) < this.name = name; this.number = number; 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(); Try this it will work. Most of you made a mistake by not adding space after : (colon) in the console log.

function contact(name, number) < this.name = name; this.number = number; this.print=print; >function print() < console.log(this.name+": "+this.number); >var a = new contact(«David», 12345); var b = new contact(«Amy», 987654321); a.print(); b.print();

Читайте также:  Java field data type

function contact(name, number) < this.name = name; this.number = number; this.print = print; >function print() < console.log(this.name + ": " + this.number); >var a = new contact(«David», 12345); var b = new contact(«Amy», 987654321) a.print(); b.print(); Good Luck

function contact(name, number) < this.name = name; this.number = number; >var a = new contact(«David», 12345); var b = new contact(«Amy», 987654321); console.log(a.name + «:»+» » + a.number); console.log(b.name+ «:» + » » +b.number);

I know i doesn’t use print method here but it works fine. function contact(name, number) < this.name = name; this.number = number; >var a = new contact(«David», 12345); var b = new contact(«Amy», 987654321); console.log(a.name+»: «+a.number) console.log(b.name+»: «+b.number)

function contact(name, number) < this.name = name; this.number = number; this.print = print; function print() < var x = this.name; var y = this.number; console.log( x+ ": " +y ); >> var a = new contact(«David», 12345); var b = new contact(«Amy», 987654321); a.print(); b.print(); // I tried this and it worked for me.

function Contact(name, number) < this.name = name; this.number = number; this.print = function ()< console.log(name+": "+number) >> var a = new Contact(«David», 12345); var b = new Contact(«Amy», 987654321) a.print(); b.print(); This was the shortest code I could do for this

function contact(name, number) < this.name = name; this.number = number; this.print = () =>console.log(`$: $`); > var a = new contact(«David», 12345); var b = new contact(«Amy», 987654321); a.print(); b.print();

Источник

Оцените статью