0

Good morning. I have two type Car and Person. I want to use this to create variable name and brand and call ring and display in.

create variable with type Person and Car class and display https://code.sololearn.com/W3NB6Tkg7Lml/?ref=app

17th Aug 2022, 7:04 AM
Malick Diagne
Malick Diagne - avatar
3 odpowiedzi
+ 1
// For example in this way: class Car { constructor(brand){ this.brand = brand; } } class Person { constructor(name){ this.name = name; } } function ring(name,brand){ return name + " " + brand; } var car = new Car("Peugeot"); var person = new Person("Malick"); let toring = ring(car.brand,person.name); console.log(toring);
17th Aug 2022, 3:21 PM
JaScript
JaScript - avatar