@jonalex05/

SuperWealthyAddresses

Nodejs

No description

fork
loading
Files
  • index.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// let person1 = {
//   name: "Alex",
//   lastname: "Cunningham",
//   age: "13",
//   city: "little elm",
//   info: function(){
//     return `${this.name} ${this.lastname} lives in ${this.city} and is ${this.age}`;
//   }
// };

// let person2 = {
//   name: "Anthony",
//   lastname: "Florentino",
//   age: "13",
//   city: "little elm",
//   info: function(){
//     return `${this.name} ${this.lastname} lives in ${this.city} and is ${this.age}`;
//   }
// };

// let person3 = {
//   name: "Aidan",
//   lastname: "Semencick",
//   age: "13",
//   city: "little elm",
//   info: function(){
//     return `{this.name} + {this.lastname} + lives in + {this.city}  + and is {this.age}`;
//   }
// };


// console.log(person1.info())

function Person(name,lastname,age,city){
  this.name = name;
  this.lastname = lastname;
  this.age = age;
  this.city = city;
}

Person.prototype.info = function() {
    return `${this.name} ${this.lastname} lives in ${this.city} and is ${this.age}`;
};

Person.prototype.ageOfBirth = function(){
  let birthYear = new Date().getFullYear() - this.age;
  return`${this.name} was born in ${birthYear}`;
};

let person1 = new Person("Alex","Cunningham",13,"little elm");
let person2 = new Person("Aidan","Semancik",14,"little elm");
let person3 = new Person("Anthony","Florentino",14,"little elm");

console.log(person1.info());
console.log(person1.ageOfBirth());

function Pet(name, lastname, age, city, type){
  Person.call(this, name, lastname, age, city);
  this.type = type;
}
let dog = new Pet("dogo", "dod", 5, "little elm", "shitzu")
let cat = new Pet("catto", "co", 5, "little elm", "maincoon")
Pet.prototype.dogoo = function(){
  return`${this.name} is ${this.age} years old and is a ${this.type}`;
};
Pet.prototype.catoo = function(){
  return`${this.name} is ${this.age} years old and is a ${this.type}`;
};
console.log(cat.catoo());
node v10.16.0