Simple Class in JavaScript
Here is the below code that demonstrate that how to create class and how to use it.
<script>
class WORKER {
#step1(){console.log("RUN step1");}
#step2(){console.log("RUN step2");}
#step3(){console.log("RUN step3");}
#step4(){console.log("RUN step4");}
#step5(){console.log("RUN step5");}
init() {
this.#renderHTMLFromURL();
}
#renderHTMLFromURL = () => {
this.#step1();
this.#step2();
this.#step3();
this.#step4();
this.#step5();
}
}
new WORKER().init();
</script>
0 comments:
Post a Comment