user => first name and last name, return full name as a String
class User{
constructor(name, lastName){
this.name = name;
this.lastName = lastName;
}
get fullName(){
return this.name + " " + this.lastName;
}
}
var user = new User("", "");
console.log(user.fullName);
media => TvShows, movies, (episode, season), (duration)
class Media{
constructor(name, year, imdb){
this.name = name;
this.year = year;
this.imdb = imdb;
}
}
class Tvshows extends Media{
constructor(name, year, imdb, episodes, seasons){
super(name, year, imdb);
this.episodes = episodes;
this.seasons = seasons;
}
}
class Movies extends Media{
constructor(name, year, imdb, duration){
super(name, year, imdb);
this.duration = duration;
}
}
find the mileage of the car
class Car {
constructor (year) {
this.year = year;
}
getAge(now){
return now - this.year;
}
}
let mini = new Car(2018)
console.log(mini.getAge(2022));
Top comments (0)