John_IV

Untitled

Jun 13th, 2020
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Article {
  2.     title;
  3.     comments;
  4.  
  5.     constructor(title) {
  6.         this.title = title;
  7.         this.comments = [];
  8.     }
  9.  
  10.     comment = class Comment {
  11.         info;
  12.         logs;
  13.  
  14.         constructor(info) {
  15.             this.info = info;
  16.             this.logs = [];
  17.         }
  18.  
  19.         moreInfo = class MoreInfo {
  20.             information;
  21.  
  22.             constructor(information) {
  23.                 this.information = information;
  24.             }
  25.         }
  26.     };
  27. }
  28.  
  29. let art = new Article('My Article');
  30.  
  31. let comment = new art.comment('comment1');
  32. comment.logs.push(new comment.moreInfo('moreInfo1'))
  33.  
  34. art.comments.push(comment)
  35. console.log(art.comments[0].logs[0].information); // moreInfo1
Advertisement
Add Comment
Please, Sign In to add comment