Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Study</title>
- </head>
- <body>
- <div id="output"></div>
- <script>
- `use strict`
- function PrinterMachine(fontColor, fontSize, fontFamily, outputId = 'output') {
- this._fontColor = fontColor;
- this._fontSize = fontSize;
- this._fontFamily = fontFamily;
- this.print = function(message = 'Nice day to learn JS!')
- {
- output.innerHTML += `<h2 style="font-size: ${this._fontSize}px; color: ${this._fontColor}; font-family: ${this._fontFamily}"">${message}</h2>`;
- }
- }
- {
- let printer1 = new PrinterMachine('red', 20, 'sans');
- let printer2 = new PrinterMachine('blue', 50, 'cursive');
- printer1.print();
- printer2.print('Nice day to kill DJ ;]');
- printer1.print('London is a capital of... who knows what!? :(')
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement