Advertisement
avr39ripe

jsPrinterMachine

Mar 22nd, 2021
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Study</title>
  6. </head>
  7. <body>
  8.     <script>
  9.         'use strict'
  10.  
  11.         class PrintMaсhine {
  12.             constructor(size, color, family) {
  13.                 this.size = size
  14.                 this.color = color
  15.                 this.family = family
  16.             }
  17.  
  18.  
  19.             print(msg) { document.write(`<p style="font-size: ${this.size}; color: ${this.color}; font-family: ${this.family}">${msg}</p>`); }
  20.         }
  21.  
  22.         let text = new PrintMaсhine('16px', 'red', 'cursive');
  23.         text.print('Nice snowy .. spring :()!');
  24.  
  25.         let text1 = new PrintMaсhine('26px', 'blue', 'sans');
  26.         text1.print('OOP in JS is Evil technology :)');
  27.  
  28.     </script>
  29. </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement