Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Person(fullname, age) {
- this.fullname = fullname;
- this.age = age;
- }
- var people = [];
- function run_demo() {
- people.push(new Person("Johnny", 17));
- people.push(new Person("Martin", 19));
- people.push(new Person("Peter", 20));
- var fullnames = people.filter(function (person) {
- return person.age >= 18;
- }).map(function (person) {
- return person.fullname;
- });
- let res = document.getElementById("result");
- let inner_text = "";
- for (let item in fullnames) {
- inner_text += fullnames[item];
- inner_text += "<br/>";
- }
- res.innerHTML = inner_text;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement