-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (26 loc) · 805 Bytes
/
script.js
File metadata and controls
30 lines (26 loc) · 805 Bytes
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
const para1 = document.getElementById("para1");
let people = [];
class person {
constructor(name, weight, height, age) {
this.name = name;
this.weight = weight;
this.height = height;
this.age = age;
}
}
function addPeople() {
people.push(new person("dude", "3000", "6'6", "3"));
people.push(new person("annnie", "can't tell", "160", "don't ask"));
people.push(new person("magimix 2000ator", "Heavy"));
}
function printPeople() {
if (people.length > 0) {
for (const { name, weight, height, age } of people) {
const para = document.createElement('p');
para.textContent += `name:${name} weight:${weight} height:${height} age:${age}`;
para1.appendChild(para);
}
}
}
addPeople();
printPeople();