S
S
SEACRE5T2021-06-07 17:21:58
JavaScript
SEACRE5T, 2021-06-07 17:21:58

How to "visit" the returning html into a class instance property?

I want after calling this.create(tag) the result will be placed in this.element

class TEST_DOM {
    constructor(place) {
        this.element = this.create;
        this.place = place;
    }

    create(element) {
        const html = document.createElement(element);
        return html;
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Confy, 2021-06-07
@SEACRE5T

class TEST_DOM {
  constructor(place) {
    this.place = place;
  }

  create(element) {
    const html = document.createElement(element);

    this.element = html;
    return html;
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question