SHARE
TWEET

Untitled

a guest Aug 21st, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function classCat(arr) {
  2.     let cats = [];
  3.  
  4.     class Cat {
  5.         constructor(name,age) {
  6.             this.name = name;
  7.             this.age = age;
  8.         }
  9.  
  10.         meow() {
  11.             console.log(`${this.name}, age ${this.age} says Meow`);
  12.         }
  13.     }
  14.  
  15.     for (let i = 0; i < arr.length; i++) {
  16.         let catData = arr[i].split(' ');
  17.         let name, age;
  18.         [name, age] = [catData[0], catData[1]];
  19.         let cat = new Cat(name, age);
  20.  
  21.         cat.meow();
  22.     }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top