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
1 Answer
+ 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);