0

Can anyone help to remove space from my code

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();

10th Apr 2021, 5:16 AM
Harshita Kumari
Harshita Kumari - avatar
2 Réponses
+ 4
If you need output without any space console.log(name,":",number) Replace with console.log(name+":"+number)
10th Apr 2021, 5:25 AM
SAN
SAN - avatar
+ 2
You can use + instead of , like name + "brooh "+ other_name
10th Apr 2021, 5:17 AM
Ananiya Jemberu
Ananiya Jemberu - avatar