as a way to finally learn JS I've decided to create a crossword creating tool
piece of my code:
var Crossword = function(content) {
Object.defineProperties(this, {
el: {
value: this.createPlaceholder(content.insertBefore)
},
words: {
value: this.createWords(content.words)
}
});
};
Object.defineProperties(Crossword.prototype, {
createPlaceholder: {
value: function(afterId) {
var after = document.getElementById(afterId),
parent = after.parentNode,
placeholder = document.createElement("DIV");
placeholder.classList.add("crossword");
parent.insertBefore(placeholder, after);
return placeholder;
}
},
createWords: {
value: function(data) {
//create words append them to this.el
}
}
)};
is there any way for me to get the this.el value in createWords method without using individual defineProperty functions in the constructor?
i know, the whole idea might not be best, but I'm just wondering if there is a possibility...