Last active
October 2, 2018 05:19
-
-
Save faelplg/b42ea57b3a7753ca28ad54e6d6be3ab4 to your computer and use it in GitHub Desktop.
An index.js file using ES6 arrow function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Generator { | |
createParagraph(__string) { | |
const textNode = document.createTextNode(__string); | |
const paragraphElement = document.createElement('P'); | |
paragraphElement.appendChild(textNode); | |
return paragraphElement; | |
} | |
createDiv(__innerNode) { | |
const divElement = document.createElement('DIV'); | |
if (__innerNode) { | |
divElement.appendChild(__innerNode); | |
} | |
return divElement; | |
} | |
} | |
const gen = new Generator; | |
const par = gen.createParagraph('Boo! ƪ(ړײ)ƪ'); | |
const div = gen.createDiv(par); | |
document.body.appendChild(div); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment