0
You are working on a Contact Manager app. You have created the contact object constructor, which has two arguments, name and nu
Help me
25 ответов
- 6
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();
+ 7
Prabu S please show your attempt.
+ 3
I'm not working on this App?
+ 1
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.
+ 1
Spentify your code error showing in the output
+ 1
Your code should be in this way
+ 1
Rajesh here ans is
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();
0
In java script
0
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();
0
I tried many times but I fail pls help me Spentify
0
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();
Spentify
0
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();
0
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();
0
need help please
function contact(name, number) {
this.name = name;
this.number = number;
this.print=print;
function print(){
this.name+":"+this.number;
}
}
var a = new contact("David", 12345);
var b = new contact("Amy", 987654321);
a.print();
b.print();
it doesnt give me an error but there is no output
i get the same results with this
function contact(name, number) {
this.name = name;
this.number = number;
this.print=print;
}
function print(){
this.name+":"+this.number;
}
var a = new contact("David", 12345);
var b = new contact("Amy", 987654321);
a.print();
b.print();
this is too confusing
0
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();
0
function contact(name, number) {
this.name = name;
this.number = number;
this.print =print2;
}
function print2 () {
console.log(this.name + ": " + this.number);
}
var a = new contact("David", 12345);
var b = new contact("Amy", 987654321)
a.print();
b.print();
0
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();
0
this.print = function (){
return console.log(`${this.name}: ${this.number}`);
0
There's two ways of writing this and that is where people are getting confused.
the first is written like so;
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();
the second is written like so
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();
- 2